Skip to main content

Full text of "Micro 6502 Journal Issue 57"

See other formats




6%«o '/yoo 



U.S./Canada Edilion: 
Inlernationai Edition: 



$2.50 
$2.95 



rEBRUARY 1983 -^^^ ^i^fl/f^^^.i^^' united Kingdom Edition: £2^00 




Advancing Computer Knowledge 




PET Vet: Commodore 64's Super Sound 



FIRST THINGS FIRST. 
LEARN ALL ABOUT P 



When you don't know the first thing about your new 
Apple 11* you need a friendly, cheerful, easy going teacher at 
your side. And the ELEMENTARY APPLE is just that kind of 
book. 

It sweeps away the confusion— explains your Apple in 
everyday language — shows you how to hook it up, how to use 
the keyboard and work on the screen. 

Gently and carefully it gives you an understanding of all 
the things your Apple can do. And then, it even shows how 
easy it is for anyone to write a simple program— provides 
common sense answers about graphics, utility programs, and 
the how and why of word processors, business programs and 
hardware like printers. 



VISA/MASTERCARD accepted. $2.00 shipping/handling charge. 
(California residents add 6'/4% sales tax) 
•Apple II is a trademark of Apple Computers, Inc. 



Yes, there's a lot of information. But, not one chapter c 
one word is dull or difficult to follow or complicated. Prove i 
yourself. Visit your computer store. Open the ELEMENTAR 
APPLE. Read a page of the introduction, then flip it open 
anywhere and read a paragraph or so. You'll find it's as 
understandable, as helpful and as marvelous as we say. 

If you, ora memberof yourfamily, is an Apple beginn 
this is the book you need. It'll teach you everything you war 
know, in the way you want to learn. 

Only $14.95. At computer and book stores, or 

aDAlAMOSTi 

9748 Cozycroft Ave., Chatsworth, CA 91311. (213) 709-1202 




2MHZ 6809 SYSTEMS 



variety to choose from! 



$17,498.99 



• DMA Double Density Floppy Disk Controller 

• Dual 8" DSDD Floppy Disk System 

• Dual Winchester Subsystem with 
Two19 MB 5V4" Winchester Drives 

• OS-9 Text Editor 

• OS-9 Assembler 



$8998.09 



• 4 RS232C Serial Ports 

• 1 MB 5V4" Floppy Disk Drive 

• DMA Double Density Floppy Disk Controller 

• OS-9 Debugger 

• OS-9 Assembler 



GIMIX offers you a 

38 MB WINCHESTER SYSTEM 

HARDWARE FEATURES: 

• 2MHz 6809 CPU 

• 512KB Static RAM 

• 8 RS232C Serial Ports 

• 2 Parallel Ports 
SOFTWARE FEATURES: 

• OS-9 LEVEL TWO Multi-User 
Operating System 

• OS-9 Debugger 

19 MB WINCHESTER SYSTEM 

HARDWARE FEATURES: 

• 128K Static Ram 

• 2MHz 6809 CPU 

• 19 MB 5V4" Winchester DMA Subsystem 
SOFTWARE FEATURES: 

• OS-9 LEVEL TWO Multi-User 
Operating System 

• OS-9 Text Editor 

128KB MULTI-USER SYSTEM $6997.39 

HARDWARE FEATURES: 

• 2MHz 6809 CPU • 2 RS232C Serial Ports 

• DMA Double Density Floppy Disk Controller • Dual 8" DSDD Floppy Disk System 

• 128KB Static Ram 

SOFTWARE FEATURES: Your choice of either UniFLEX or OS-9 LEVEL TWO. Both are Unix-like 
Multi-User/Multi-Tasking Operating Systems. 

56KB FLEX/OS-9 "SWITCHING" SYSTEM $4148.49 

HARDWARE FEATURES: 

• 2MHz 6809 CPU • DMA Double Density Floppy Disk Controller 

• 56K Static Ram • 2 Built-in 5 V4" 40tr DSDD Disk Drives 

• 2 RS232C Serial Ports (80 Track DSDD Drive Option . . add $400.00) 
SOFTWARE FEATURES: 

• GMXBUG monitor — FLEX Disk Operating System 

• OS-9 LEVEL ONE Multi-tasking operating system for up to 56K of memory 

WINCHESTER SUBSYSTEMS 

Winchester packages are available for upgrading current GIMIX 6809 systems equipped with DMA controllers, at least one 
floppy disk drive, and running FLEX, OS-9 LEVEL ONE or OS-9 LEVEL TWO. The packages include one or two 19MB (unformat- 
ted) Winchester drives, DMA Hard Disk Interface, and the appropriate software drivers. The Interface can handle two SVi" 
Winchester Drives, providing Automatic Data Error Detection and Correction: up to 22 bit burst error detection and 1 1 bit burst 
error correction. 

Dual drives can be used together to provide over 30 MBytes of on line storage -- or use one for back-up of the other. (More 
convenient and reliable than tape backup systems. 

#90 includes one 19MB Drive, Interface, and Software $4288.90 

#91 includes two 19MB Drives, Interface, and Software $6688.91 

Contact GIMIX for systems customized to your needs or for more information. 
50 HZ Export Versions Available 

GIMIX Inc. reserves the right to change pricing and product 

specifications at any time without further notice. 1 337 WEST 37th PLACE 

CHICAGO, ILLINOIS 60609 

GIMIX® and GHOST® are registered trademarks of GIMIX Inc. ,o^ ov qo-? cc-in 



FLEX and UniFLEX are trademarks of Technical Systems Consultants Inc. 
OS-9 is a trademark of Microware Inc. 



Eimix 



inc. 



TWX 910-221-4055 



1982 GIMIX Inc. 



Emulates these teminals 

IBM 3101 
DEC VT100, VT52 
Oata General D200 
ADDS Regent 20, 25, 40 
HazeWne 1400, 1410, 1500 
Lear Siegler ADM-3A, ADM 
TeleVMeo 910 
Teletype Model 33 KSR 



Apple is a trademaiti of 
Apple Computei; Inc. 










New File Transfer Language 



Your host compu 

won't know the difference! 

Softertn provides an exact teftninal emulation 
for a wide range of CRT terminals which interface 
to a variety of host computer systems. Special 
function keys, sophisticated editing features, 
even local printer capabilities of the terminals 
emulated by Softerm are liilly supported. Softerm 
operates with even the most discriminating host 
computer applications including video editors. 
And at speeds up to 9600 baud using either a 
direct connection or any standard modem. 

Unmatched file transfer capability 

Softerm offers file transfer methods flexible 
enough to match any host computer requirement. 
These include character protocol with user- 
definable terminator and acknowledge strings, 
block size, and character echo wait, and the 
intelligent Softrans^ protocol which provides 
reliable en'or-free transmission and reception of 
data. The character protocol provides maximum 
flexibility for text file transfers. Any type file 
may be transfered using the Softrans protocol 
which provides automatic binary encoding and 
decoding, block checking with error recovery, and 
data compression to enhance line utilization. 
A FORTRAN 77 source program is supplied with 
Softerm which is easily adaptable to any host 
computer to allow communications with Softerm 



using the Softrans protocol. 

Softerm file transfer utilizes an easy to use 
command language which allows simple defini- 
tion of even complex multiple-file transfers with 
handshaking. Twenty-three high-level commands 
include DMt CATALOG, SEND, RECEIVE, 
ONERR, HANGUP, MONITOR and others which 
may be executed in immediate command mode 
interactively or from a file transfer macro com- 
mand file which has been previously entered 
and saved on disk. 

Built-in utilities 

Softerm disk utilities allow DOS commands such 
as CATALOG, INIT RENAME, and DELETE to be 
executed allowing convenient file maintenance. 
Local file transfers allow files to be displayed, 
printed, or even copied to another file without 
exiting the Softerm program. Numerous editing 
options such as tab expansion and space com- 
pression are provided to allow easy reformatting 
of data to accommodate the variations in data 
formats used by host computers. Softerm sup- 
ports automatic dialing in both temiinal and file 
transfer modes. Dial utilities allow ap/io/ie book oi 
frequently used numbers to be defined which are 
accessed by a user-assigned name and specify 



BREAK 

CATALOG 

CHAIN 

CONFIGURE 

CONNECT 

CONVERSE 

DIAL 

END 

HANGUP 

LOG 

MONITOR 

NOLOG 

ONERR 

PAUSE 

PROMPT 

RECEIVE 

REMARK 

RETRIES 

SEND 

SPECIAL 

SPEED 

TIMEOUT 

XMIT:WAIT 



Supports tliese 
interface txiards 



I Apple Communications Card 

Apple Parallel Printer 

Apple Serial Interface 

' Apple Super Serial Card 

Bit 3 Dual-Comm Plus™ 

CCS 7710,7720, 7728 

Hayes Micromodem ir 

Hayes Smartmodem™ 300, & 1200 

Intra Computer PSIO 

Mountain Computer CPS Card™ 

Novation Apple-Cat ir 300 & 1200 

Orange Micro Grappler™ 

Prometheus VERSAcard™ 

SSMASIO,APIO,AIO,AIOir 

Supports your 80-column tiardware 

ALS Smarterm™ 

Bit 3 Full- View 80™ 

Computer Stop Omniviston'" 

M&R Sup'R7erminar 

STB Systems STB-80" 

Videx Videotemi" 

Vista Computer Vision 80™ 

Wesper Micro Wizard 80™ 



the serial interface parameters to be used. 

Online Update Service 

The Softronics Online Update Service is pro- 
vided as an additional support service at no 
additional cost to Softerm users. Its purpose 
Is to allow fast turnaround of Softenn program 
fixes for user-reported problems using the 
automatic patch facility included in Softerm 
as well as a convenient distribution method for 
additional terminal emulations and 1/0 drivers 
which become available. User correspondence 
can be electronically mailed to Softronics, and 
user-contritxjted keyboard macros, file transfer 
macros, and host adaptations of the Softrans 
FORTRAN 77 program are available on-line. 

Most advanced communications 
software available 

Just check Softerm's 300 page user manual. 
You simply can't buy a more sophisticated 
package or one that's easier to use. Available 
now for only $150 from your local dealer or 
Softronics, Inc. 

SOFTRONICS 

6626 Prince Edward, iVIemphis.TN 38119.901-755-5006 



MICRO 



No. 57 - February 1983 



iAIOK) 



February HigKlights 



Expanding your knowledge of computer languages — or 
just increasing your familiarity with many of them — can 
help improve your programming skills. This month's 
issue covers FORTH, Pascal, APL, and LISP, and provides 
you with a valuable information sheet of language 
packages offered by seventy vendors. 

"EDIT, An Atari FORTH Screen-Oriented Editor" by 
Mike Dougherty (p. 47) uses the Atari 800 display as a text 
window into a FORTH disk screen. You can use Atari's 
special function keys to prepare FORTH applications. In 
"Apple Pascal Hi-Res Screen Dump" |p. 54), Robert 
Walker presents a high-resolution graphics screen dump 
for Apple Turtle graphics to the Epson printer with 
Graphtrax. Terry Peterson discusses the history and ad- 
vantages of APL, a language known for its high execution 
speed, powerful features, yet cryptic character set — read 
"APL on the SuperPET" (p. 43). "The World According to 
LISP" by Steve Cherry (p. 65] is a good introduction to 
LISP, a language many computerists consider strange and 
obscure. Cherry outlines the major strengths and features 
of LISP, as well as its structure. 

Commodoie 

In addition to the SuperPET article in our feature sec- 
tion, we have several PET articles and one on the VIC-20. 
"Microcomputer- Aided Instrumentation" (p. 89) by 
Deborah Graves, et. al., is a continuation of our series on 
Microcomputers in a College Teaching Laboratory (Part 
rv) . Learn how to interface a microcomputer to two types 
of scientific instruments — a spectrophotometer and a 
chromatograph. If you want to convert Tiny PILOT to 
your 8K PET, read "More on Tiny PILOT" by Arthur 
Kunkins (p. 78). The author solves a few tricky problems 
and provides detailed explanations of some of the com- 
mands. David W. Priddle provides a utility program in 
"IEEE-488 Control of PET/CBM" (p. 11). You can add 
four new commands to your PET/CBM to make it an ef- 
fective, inexpensive controller for use with many scien- 
tific instruments. The program requires 4.0 BASIC. And 
this month we present the third installment of Jim 
Strasma's "It's All Relative" (p. 33|. }im explains how to 
use the key file as an index into a relative file. He uses, as 
an example, a powerful mail-list package available to the 
public. Our VIC-20 contribution describes the hardware 
and software needed to interface RS-232 devices to Com- 
modore's VIC computer. See Michael V. Tulloch's article, 
"An RS-232 Printer for VIC" |p. 17). You will also learn 
how to convert RS-232 voltages to TTL, convert hex code 
data to POKES, and use a CTS line from the VIC. 



Apple 

Along with the Apple articles in our language feature, 
we offer an "Applesoft BASIC Routine for CAI" by Robert 
Phillips (p. 81). With this routine you can trap errors, 
isolate mistakes, and overlook typographical errors. Mr. 
Phillips also discusses some uses for a match routine, and 
presents just such a routine in BASIC. 

Columns 

This month's column on the Color Computer shows 
you how to interface your machine-language routines with 
BASIC (p. 92). John Steiner discusses the use of a RAM 
hook and presents a routine that interfaces with the LIST 
and LLIST commands to page a list on the screen. Tim 
Osbom presents BUILDIT (Apple Slices], a routine that 
makes programs external to VisiCalc create and access 
VisiCalc worksheet files (p. 95). Whether you are a begin- 
ner or pro, you can learn something from this program. 
Paul Swanson, in From Here to Atari (p. 31] discusses 
languages available for the Atari and answers several 
readers' questions on hardware. Commodore 64 fans will 
want to read Loren Wright's comments on the system's 
exciting sound capabilities [p. 71). He takes a look at 
music software, including Synthy 64, a musical composi- 
tion program from Abacus Software. 



ilMCftO 



NEW SECTION! 

BEGINNING NEXT MONTH 
Ttirn to page 112 for more information on 
our new section for the SERIOUS NOVICE 
appearing for the first time next month. 

VIC BOOK! 

Turn to PET Vet, page 73, for details on our 
soon-to-be-published book for the VIC. 



No. 57 - February 1983 



MICRO 



Announcing * , 

Th^ best 6502 Assembler in the World 



Now. The kind of high-level 
Aipport you'd only expect 
tofind%n a malhlrame 

ORCA/M {Hayden'i (^t'/ 't 
Relocatable Code/ v he- 



for Micros) lets you 



"f 



sopljjsticated applh 'i'" - 
with the speed and • ' *. f 
high-level language . tift.ir 
the control and effi KTL.thit 
only assembly tang 1 1 . ir' 
Q§/e. * 

Here's what ORCA M gives 
you: 

The Assembler 

Macro language features 

o Conditional sssemT. t 

source and macro ■ '•• 
o Separate soufte ar I '■ a ri ■ 

files 
o Nestable macros 
o Parameter mid-atn ■■. or il 

string search f unct i < 
o SymboWfc paramet* ■ 

assignment • 

o Numeric, string, ar^i i-r ik ,i 

type parameters 
o Parameter subscn I'l ^ 
o Global ^mmunicci t 

between macros 
o Macro expansion I t* nt'ol 
o Count, length and ,!:• 

parameter-atf'hut' ' ■■'■.Pa 



Extensive Macro Libraries 

Memory Constant 
Declarations: 

Inti-'jer 
' Cnatacli ■ 
- •-nar-bjteii'teg* r 
' H'-'Xucfeciii .» 
■ [ kiut'r q Pj rt 

Relocatable obiect module 
generation 

Fast assembly directly to 
disk 

Program segmentation : 
■ SflcctiveW absembtf individ- 
ij ii sjhroiit'nes 
Glooal and oi''d> scopt. ot 
s.mbols 

The Linker 

Produce executable binary 

files from relocatable object 

modules 

Link routines from library 

files 

Link subroutine 
re-assemblies 

Define a new origin for pre- 
viously assembled code 

Invoke at assembly time or 
byCommand 

Subroutine libraries. 

FioritiPvj fftfnt anddoub'e 
prprrsrop roufnes • 
Tr in(^ondfc'RT?liLJiirt'Or»% 
H and'uros'jijphcs 
P/'jItipIp pr-^L-s.! in rntpgpr 
mith • 

Irriit and w.tpor 



The Editor 

Co-resident screen editor: 

''< Gl utidt sparcn and replaco 
'B'Of.krnovF • 

. Entrv I'f t lon keyboatrf 
cnur..''teri 

Supports lower case 
adapters and shift-kfy * 
modification • * 

80-cofumn: fiariz^i||fl * m * 
scrolling with 4^9pkinA 
displays •* 

TheSysterr ,- _ 

Monitor: transparent con- 
trol of systpm from one 
command Eavef 
Extended Disk Commands: 

- Fi(«"'crpy 
■ F'lc undetete 
' Cdtalogsorl 
'iVtidcard tilendnes 

Disk ZAP: Built-in disk 
sector editor 

OptimFzed DOS 3.3 compat- 
ible operating systent 
Operating system interface. 

" Suuports d variety >Ti 
rur'.'igurattona 
User-nodtdabte tQdllow link 
aqr nf custon^ dnwrs for " 
F»-rpner3ls 

64fcEIAM supported, • 
48k required' 

• Tr £ jnique 4rrayot t&atjrus 
^r 1 * ^nction*' sp(.dM for 
tjt'lf*[re pcwec of ORCA j* 
i[ ■• I'p-sseri 



All fpatures tire doruniented 
ctearlv jnl i-'^ten-iv'Bly Zotno- 
I'StiogbTUi the s.ibioj'iino 
'ind n*cro Irbr^nps a"! Wf II 
dS tn^- opi-'.nng •^•■ter-i, I'.c 
II ''lud«=d 

ORCA. !t yL^ij'rt.' sc rioiis dbi'fit 
d^t'opi!-igtj'j02*oftWfjr»» its 

the fane tjhjv 

• 

A^laBi' 'r^rr \o*r 1'a: j| 



de^ler^Ld^ 



iln MA f:dilft»937020or 
ORCAM 2T6m» 
ApDte II d\'i',. "tSk DOS 3 3 
Tvvo or'ves andfwt 
rpcarrmended • • 

Introductor/Price: 
$99.95 • • 






• • 



HAY DEN 



sowwmMmE 



STAFF 

President/Editor-in-Chief 
ROBERT M. TRIPP 

Publisher 

MARY GRACE SMITH 

Editorial Staff 

PHIL DALEY — Technical editor 
JOHN HEDDERMAN — Jr. programmer 
MARJORIE MORSE — Editor 
JOAN WITHAM — Editorial assistant 
LOREN WRIGHT — Technical editor 

Graphics Department 

HELEN BETZ — Director 

PAUU\ M, KRAMER — Production mgr. 

EMMALYN H. BENTLEY — Typesetter 

Sales and Marketing 
CATHI BLAND — Advertising manager 
CAROL A. STARK — Circulation mgr, 
LINDA HENSDILL — Dealer sales 
MAUREEN DUBE — Promotion 

Accounting Department 
DONNA M. TRIPP — Comptroller 
KAY COLLINS — Bookkeeper 
EILEEN ENOS — Bookkeeper 



Contributing Editors 
CORNELIS BONGERS 
DAVE MALMBERG 
JOHN STEINER 
JIM STRASMA 
PAUL SWANSON 
RICHARD VILE 



Subscription/Dealer inquiries 
(617)256-5515 



DEPARTMENTS 


3 


February Highlights 


7 


Editorial 


9 


Updates 


31 


From Here to ATARI 


71 


PET Vet 


92 


CoCo Bits 


95 Apple Slices 


98 


Reviews in Brief 


101 


Software Catalog 


103 


Hardware Catalog 


104 


6809 Bibliography 


105 


Information Sheet 


109 


Data Sheet 


111 


Advertiser's Index 


112 


Next Month In MICRO 



No. 57 • February 1983 



NO. 57 FEBRUARY 1983 

IMCftO 

Advancing Computer Knowledge 

LANGUAGE FEATURE 

42 SuperPET APL Terry Petersen 

^^ An unusual, but powerful, fast, and memory-efficient language 

A J EDIT: An Atari FORTH Screen-Oriented Editor Mike Dougherty 

^ ' A big improvement over the APX line editors 

54 APPLE Pascal Hi-Res Screen Dump Robert d. waiker 

^^ Dump the high-resolution graphics screen to your printer 

CO An Introduction to FORTH Ronald W. Anderson 

^^ All about Reverse Polish Notation, colon definitions, and other FORTH features 

CO FORTH for the 6809 Ronald W. Anderson 

^^ A lool< at CCFORTH, figFORTH, and several FLEX-based systems 

gc The World According to LISP Steven cherry 

^^ A powerful language suited to robotics and artificial intelligence 

I/O ENHANCEMENTS 

-i -i Improved IEEE-488 Control for PET/CBM David w. Priddie 

' ' More precise control of the bus, without using logical files 

H 7 VIC RS-232 Printer i^ichaei v. Tuiioch 

' ' Interface the Radio Shack Quick Printer and other RS-232 devices 

op PROM BASIC for the C1 P David a. Jones 

^^ Increase the 01 P's performance without a disk drive 

OQ Indirect Files Under OS-65D Richard L Tretheway 

^^ Use the indirect file to merge programs, perform warm starts, transfer programs. 

BASIC AIDS 

oo It's All Relative, Part 3 

Using Commodore's Relative Records Jim strasma 

Use a key file as an index into a relative file 

oy A Binary Search Routine Alfred j. Bruey 

^ ' Two demonstration programs illustrate this technique 

Af) BASIC Renumber for OSI Paul Krieger 

^^ Renumber programs in memory and save to tape 

EDUCATIONAL UPDATES 

JA 68000 Program Control: Branch and Jump 

Instructions JoeHootman 

78 More on Tiny PILOT for the PET Arthur Hunkins 

81 A BASIC Match Routine for CAI Robert Phuiips 

86 An Overviev\/ of Educational Softv\/are George Gerhoid 

QQ Microcomputers in a College Teaching Laboratory, 

^^ Part 4 Deborah Graves, Richard H. Heist, Thor Olsen, Howard Saltsburg 

MICRO 5 



EVERYONE NEEDS A . . . 



I 6 MINUTES 
> V<AC LINE 
I 2 MINUTES 



Guardian a^geu 

^"electronics. IMr 



iKimgwef^aji 



m- 







^-'-%. 



fWJ- 



'/■:■/ 



• ■<*-« 



:-«• 



ii'e, 



X-ii>'E>ISC DRIVE 






■43- -.'■•iBfl^ii ■^?.- " K 

SAVE^OURDfATA 
FFfOM POWER OUTAGES! 




PRINTER 



BACKUP FORYOUR COMPUTER, MONITOR, PRINTER AND 5V4 " FLOPPY AND HARD DISC DRIVE 

• Automatically stops arvtioying problems from power line interruptions and brown outs • You need standby power to save data 

• Maintenance tree backup power available in t15 volt or 220 volt • 50 or 60 HZ • 150 wat'ls • Complete versatility — operate 
yoursystem from a 12 volt source, i.e., automobile cigarette lighter, boat or airplane • Rugged self contained gel cell battery 

• No voiding warranty — no cutting wires • Automatic audio alarm warning tone during commercial power failure or interrupt 

• UL listed • FCC approved • Transient voftage suppressor gives added insurance from line voltage SpikeS, utilizing Zener Ray^w 

• Green/red LED power status indicator • Green — normal AC line power • Slow blinking red — at least 6 minutes of remaining 
standby power • Fast blinking red — approximately 2 minutes ol remaining battery power • Solid state technology unexcelled 
by any UPS power unit in its class. 



^ 



ELECTRONICS, INC. 

COPYRIGHT © 1981 ■ PATENTS PENDING 

566 IRELAN, BUELLTON, CA 93427 
(805) 688-2047 



SEE YOUR RH ELECTRONICS 
PRODUCTS DEALER 

FOR YOUR APPLE II*: 

SUPER FAN M™ S 74.95 

SUPER FAN ir"/ZENER RAY™ $109.00 

SUPER RAM II™ $125.00 

■"^RH 12V0LTTRANSVERTER $149.00 

FOR MICRO COMPUTERS: 

GUARDIAN ANGEL™ $595.00 



About the Cover 




Aquarium personnel now use micro- 
computers extensively for research, 
education, and cataloging data. The bar 
graph on this month's cover is a sample 
output from a computer used to moni- 
tor levels of toxic substances in ocean 
water. Other ways that microcomputers 
are being employed to improve the 
marine environment are as diverse as 
tracking whale migration patterns and 
feeding sites to regulating tank 
feedings with tidal rhythms. 

Special thanks to the research 
department at Boston's New England 
Aquariaum for the time they spent 
with us discussing their work. 

Cover photo: Phil Daley 
Cover Graphic: Generated by program 
written by Art Arizpe 



JMCftO is published monthly by: 
MICRO INK, Chelmsford, MA 01824 
Second Class postage paid at: 
Chelmsford, MA 01824 and additional 

mailing offices 
USPS Publication Number: 483470 
ISSN: 0271-9002 



Send subscriptions, change of address, USPS 
Form 3579, requests for back issues and all 
other fulfillment questions to 

MICRO INK 
34 Chelmsford Street 
P.O. Box 6502 
Chelmsford, MA 01824 

or call 

617/256-5515 

Telex: 955329 TLX SRVC 

800-227-1617 



Subscription Rates 
U.S. 

Foreign surface mail 
Air mail: 
Europe 

Mexico, Central America, 
Middle East, North Africa, 
Central Africa 

South America, South Africa, 
Far East, Australasia, 
New Zealand 



Copyright© 1982 by MICRO INK 
All Rights Reserved 



Per Year 

$24.00 

2 yr. / $42.00 

$27.00 



$42.00 



$48.00 



$72.00 



/MCftO 

Editorial 



Oiir language f eaUire this month provides 
an appropriate forum for our Editor-in- 
Chief Bob Tripp, and Technical Editor 
Phil Daley, to express their opposing 
views on BASIC. It won't take long to 
figure out who is pro and who is con. 
What are your thoughts on BASIC? 

Too Basic or Not Too Basic 

According to John Kemeny, one of 
the originators of BASIC, the main in- 
tent was to provide the user with 
friendly access to the computer. This 
emphasis on user friendliness is the key 
to BASIC'S popularity. The key word in 
Beginner's All-purpose Symbolic In- 
struction Code is the first one; more 
microcomputer programmers start 
with BASIC than any other language. 

Without BASIC the microcomputer 
world would never have gotten off the 
ground. Its simplicity, forthright clarity, 
memorable mnemonics, and inter- 
active friendliness combine to make it 
the best all-round microcomputer pro- 
gramming language. When the micro 
had only 4K of ROM and 2K of RAM, 
BASIC was a necessity; even now with 
64K- and 128K-RAM machines, loading 
a monolith language returns you to 
limited memory constraints. 

Other languages, such as FORTRAN 
and COBOL, make it easy to do pro- 
gramming and to understand the pro- 
gram. Unfortunately, microcomputers 
don't do them justice, and all imple- 
mentations become subsets of the 
mother tongue. 

FORTH and assembly language 
overcome many of the limitations of 
BASIC — especially its slowness — but 
they are incomprehensible jibberish to 
most folks, sometimes including the 
person who wrote the program. 

I must also mention Pascal, a fine 
structured language, but the most ex- 
asperating language in which to write a 
program. The disk accesses, even with 
three drives, are incredible. The 
routine — load the editor, load the file, 
change the file, save the file, load the 
compiler, compile the program, run the 
program, note the mistakes, load the 
editor — is enough to addle your 
brains. Any program that knows 
enough to tell you that you forgot a 
semicolon on the previous line, should 
be smart enough to insert one for you! 



Give me BASIC any day: load the 
program, run, and make changes with 
no delays. It is the only user-friendly 
language amongst the lot! 

Phil Daley 

Much Too Basic and 
Too Much BASIC! 

BASIC was designed to allow a stu- 
dent with a TTY terminal to write simple 
programs on a time-shared mainframe, 
and thousands of people received their 
initial introduction to the computer via 
BASIC. It served these purposes well. 
However, it is not a good language for 
the microcomputer. The use and abuse 
of BASIC has caused software develop- 
ment to lag behind hardware develop- 
ment. The fundamental problems are: 

1. BASIC does not make effective 
use of screen capabilities. Positioning 
the cursor is awkward, reading the cur- 
sor position is difficult, and material 
appearing on the display is virtually 
impossible to access from a program. 

2. Input routines do not permit er- 
ror checking of input, do not support 
interaction with the operator, do not 
provide support for other input devices, 
and are generally limited in capability. 

3. BASIC does not make effective 
use of disk capacities. Only the most 
basic disk file structures are supported, 
and these often have restrictions. 

4. BASIC does not support large 
programs well. The use of line numbers 
as labels makes it difficult to maintain 
and modify large programs. As programs 
grow, they become increasingly hard to 
modify, document, and imderstand. 

5. BASIC does not have simple 
techniques for manipulating string- 
oriented material. It 'thinks' only in 
decimal, which may be appropriate for 
some calculations, but is awkward for 
many requirements of hexadecimal- 
oriented computers. 

6. BASIC is slow. The overhead in- 
volved with interpreting and re- 
interpreting every line during program 
execution can make even the most effi- 
cient microcomputers appear sluggish. 
There is also a high overhead in its 
memory requirements. 

BASIC is simply too basic for many 
situations. Some programs would be 
more beneficial written in an alter- 
native language. BASIC should be used 
for introductory programming, short 
programs, numerical calculation pro- 
grams, and limited input requirements. 
It should not be used for long programs, 
disk and video-oriented applications, 
non-numerical programs, and special 
devices; in these cases, alternative ap- 
proaches should be considered. 

Bob Tripp 



No. 57 - February 1983 



MICRO 



BUSICALC 



BGSICALC A Honey of an Electronic Spreadsheet 

Why electronic spreadsheet programs? 

Electronic spreadsheet programs allow the user to create a gridsheet, 
spreadsheet, worl<sheet, or any other table of information, using the 
memory of the computer as pencil and paper The computer display or 
terminal acts as a window through which the user views the information 
as it is entered. Textual information (such as headings), numerical values, 
and formulas can easily be entered into the spreadsheet. 




o-M-a-o H a n H H n H H o B pg E5 



Efaa a a b a a a la a ora tai&i^ 





For Commodore 64 

For Commodore VIC 20 

For Commodore PET/CBM 40 columns 

For Commodore CBM 80 column/SuperPet 



BGSICALC Your Computer Drone for Repetitive Calculations 

The outstanding advantage of using a computer is that it acts not only 
as a pencil and paper but as a perfect eraser and an automatic calculator 
The user can quickly and easily make any number of alterations to the 
data within the table. The BUSICALC will evaluate any formula using the 
data that has been entered. Further, it retains the formulas and displays 
the resulting value. With BUSICALC controlling the entry of data, provid- 
ing a comprehensive memory, and performing arithmetic, the preparation 
of a spreadsheet is faster and more accurate than If it were prepared 
by hand. 

BGSICALC With the Sting Removed from the Prices 

BUSICALC 20 only $49.00 for the VIC 20 

BUSICALC 64 only $69.00 for the CBM 64 

BUSICALC 40 only $79.00 for the original 40 column PET/CBM 

BUSICALC 80 only $89.00 for the original 80 column CBMs and SuperPets 




BUSICALC AVAILABLE NOW FROM YOUR LOCAL DEALER 

(800) 227-9998 
FOR THE NAME OF YOUR NEAREST DEALER 

California, Canada, Alaska and Hawaii please call (415) 965-1735 




I 



Skyles Electric Works 

231G South Whisman Road 
Mountain View, CA 94041 



Europe please contact Supersoft, Winchester House, Canning Road, Harrow Wealdstone, Middlesex, England HA3 7SJ, Tel. 01 861 1166 



/MCftO 

Updates 
and Microbes 



In MICRO'S Commodore 64 Data Sheet [MICRO 
55:109) most of the SID's registers were inadvertently 
omitted. Here is a complete SID register list. 



Voice 1 


Voice 2 


Voice 3 


Register Function 


$D400 


$D407 


$D40E 


Frequency, low* byte 


(54272) 


(54279) 


(54286) 




$D401 


$D408 


$D40F 


Frequency, high byte 


(54273) 


(54280) 


(54287) 




$D402 


$D409 


$D410 


Pulse w(idth, \o\N byte 


(54274) 


(54281) 


(54288) 




$D403 


$D40A 


$D411 


Pulse w(idth, high nibble 


(54275) 


(54282) 


(54289) 


(bits 4-7 = 0) 


$D404 


$D40B 


$D412 


Voice Type: (bits 4-7) 


(54276) 


(54283) 


(54290) 


7 Noise 

6 Pulse 

5 Sawdooth 

4 Triangle 

3 Test 

2 Ring modulate 
(1 = on, = off) 

1 Synchronize 

Gate bit 
(1 = start attack, 
= start release) 


$D405 


$D40C 


$D413 


Attack/Decay 


(54277) 


(54284) 


(54291) 


Attack time (bits 4-7) 

2 ms - 8 ms 
Decay time (bits 0-3) 

6 ms - 24 sec 



Voice 1 


Voice 2 


Voice 3 Register Function 


$D406 


$D40D 


$D414 Sustain/Release 


(54278) 


(54285) 


(54292) Sustain level (bits 4-7) 

x/15 proportion of peak 
Release time 
6 ms - 24 sec 


Address 


Register Function 


$D415 


54293 


Filter frequency 
Bits 7-3 = 
Bits 2-0 \o\N bits 


$D416 


54294 


Filter frequency, high byte 


$D417 


54295 


Resonance/Filter Voices 
7-4 Resonance 
3-0 Filter voices 
3 external 
2 voice 3 
1 voice 2 
voice 1 


$D418 


54296 


Filter select/Master volume 
7 voice 3 off 
6 high-pass on 
5 band-pass on 
4 low(-pass on 
3-0 master volume 


$D419 


54297 


Paddle X {AID #1)~read only 


$D41A 


54298 


Paddle Y (A/D #2)~read only 


$D41B 


54299 


Digitized voice 3 w(aveform-read only 


$D41C 


54300 


Digitized voice 3 envelope-read only 



Let us know if you 've updated an atricle oi discovered a 
bug. Send a note to: Updates /Microbes, MICRO, P. O. Box 
6502, Chelmsfoid, MA 01824. iMCftO 



VIC-20 



SOFTWARE 
SPECIALS 



NEW 



A 100% machine code game with colorfui 
graphics, music, sound and a funny looking 
turtle to entertain your entire family! 
By Thomas Kim and Jimmy Huey ONLV $15.95 

II I iiiiiiiii II ii f II iiiiiiiii I ill nil liiiii III wiiiim 



'"I V'^j;;j''^K* 
FftOM iNrcMsnNG sonumnc 



A. If 





VIC-20 



FROM TRONIX 




SWARM! 

Another fast action game written 
entirely in machine language from 
Tronix, Insects Invade your Vic! 

Cassette $29.95 



DUST COVERS - $7.95 

For Vic-20 or Vic-64 

* Waterproof 

* Brown Color 

' Commodore Logo 
Protect your investment! 



^^°^ MARTIAN 
JV SOFTWARE 




STAR COMMAND 



' Intergalactic Combat! * Space Conflict 

* All Macfiine Language 
Cassette $16-95 



_^-* INTERESTING SOFTWARE 

' P 21101 S. Harvard Blvd., Torrance, CA 90501 
(213) 328-9422 
Visa/MC/Check/Money Order Add $2.00 Postage & Handling 

CA residents add appropriate sales tax Dealer Inquirers Invited 

Write tor free Catalog 



No. 57 - February 1983 



MICRO 



FOR COMPLETE GRAPHICS: 

UersakUn'ter 



EDUCATION 



Whether you are a 
teacher, an artist, an 
engineer, a 

programmer, or a ] 

hobbiest with iittle or no 
programming experience, 
the VersaWriter is the 
answer to your graphics 
need. With the VersaWriter 
expioring the worid of micro 
computer graphics is as easy 
as tracing. The VersaWriter 



ARTIST 



GAME PROGRAMMER 




doesn't just trace 
a picture though. With 
simpie one i<ey com- 
mands you can add 
coior and text to your pic- 
tures, move objects across 
the screen, mai<e scale 
drawings and even draw 
with different size brushes. 
The VersaWriter is as iimitiess 
as your Imagination. 



For complete graphics on your Apple II/II+, or IBM PC, the Versa Writer from Versa Computing, Inc. is your answer. 
Complete hardware/software system ready for use - $299. 



Send for information 
on the complete line 
of VE^^iAVik^i & Grophlcs 
Products 



V 



compuanc, inc. 



Dealer 
Inquiries 
Welcome 



3541 Old Conelo Road, Suite 104 • Newbury Parl<, CA 91320 • (805) 498-1956 



10 



MICRO 



No. 57 - February 1£ 



Improved IEEE-488 Control 

for PET/CBM 



by David W. Priddle 



This utility program for PET/CBIVI 
with 4.0 BASiC adds four new 
commands that improve the I/O 
control of the IEEE-488 bus. 
With more complete control of 
the bus, the PET/CBIVI becomes 
an effective, inexpensive 
controller for a wide variety of 
scientific instruments. 

I/O Control 

requires: 

4.0 PET/CBM or SuperPET 

The IEEE-488 bus is available on a wide 
variety of measurement and signal- 
generating equipment from a number 
of large manufacturers including 
Hewlett-Packard, Tektronix, and 
Fluke. Some of these companies also 
supply sophisticated and expensive 
microcomputers and "programmable 
calculators" that can act as instrument 
controllers using the 488 bus. The 
PET/CBM micros cost considerably 
less and are, therefore, an attractive 
alternative for use with scientific 
instruments. The disadvantages of the 
PET/CBMs are twofold: the graphics 
resolution is poor when compared to a 
Tektronix 4051, which has a 1024 x 
780 point addressable display; and 
second, the I/O techniques using 
"logical files" have limitations when 
used with equipment other than disk 
drives and printers. 

The resolution problem has been 
tackled in a variety of ways, from sim- 
ple plotting programs that offer a small 
improvement, to the addition of expan- 
sion graphics memory. The problem of 
improving the I/O control is the object 
of this current utility program. 

The Tektronix 4051/4052 systems 
offer two levels of control. High-level 
control of the bus uses the commands: 

PRINT@X,Y:a,b,c,etc, 
INPUT@X,Y;a,b,c,etc, 



Listing 1: Assembly Listing 



0001 


0000 








; 'printP27 








0002 


0000 








;aug 26,1982 






0003 


0000 










*=$O030 






0004 


0030 








;start 


o£ 


strings 






000S 


0030 










*=$0034 






0006 


0034 








; top 


£ basic 






0007 


0034 










*=$007B 






0008 


0070 








chrget 






;jump to start 




0009 


0070 










*=$0O76 






0010 


0076 








chrgot 










0011 


0075 










*=S027a 






0012 


027a 








tenip3 


* = * + ! 


;y store 




0013 


027b 








temp4 


♦ = ♦ + 1 


;i/o f lag ,0=output , $22=inpu 


t 


0014 


027c 








temps 


♦ = * + l 


; rby buE£er 




0015 


027d 








temp6 


* = * + l 


.-quote delimiter 




0016 


027e 








temp7 


* = * + l 


;colon delimiter 




0017 


027f 










*=$7e47 






0018 


7e47 


a9 


7e 




setup 


Ida 


»$7e 


;sys 32327 to setup 




0019 


7e49 


85 


31 






sta 


$31 


;change top of strings 




0020 


7e4b 


85 


35 






sta 


$35 


;and top o£ memory 




0021 


7e4d 


a9 


46 






Ida 


»$46 






0022 


7e4f 


85 


30 






sta 


$30 






0023 


7e51 


85 


34 






sta 


$34 






0024 


7e53 


a9 


4c 






Ida 


»$4c 


;put jmp (S4c) in chrget 




002S 


7e55 


85 


70 






sta 


SI?. 






0026 


7e57 


a9 


e5 






Ida 


»$e5 


.-adjust to point at start 




0027 


7e59 


85 


71 






sta 


$71 






0028 


7e5b 


a9 


7e 






Ida 


f$7e 






0029 


7e5d 


85 


72 






sta 


$72 






0030 


7e5f 


60 








rts 








0031 


7e60 


20 


70 


00 


input4 


jsr 


chrget 


.-go past delimiter 




0032 


7e63 


a2 


00 




input 


Idx 


ll$00 






0033 


7e65 


20 


C0 


£1 


input2 


jsr 


$£lc0 


.-get byte £rom ieee 




0034 


7e68 


9d 


7c 


02 




sta 


$027c,x 


.-store byte in buffer 




0035 


7e6b 


e8 








inx 








0036 


7e6c 


24 


10 






bit 


$10 


.-check, was '\' used ? 




0037 


7e6e 


30 


04 






bmi 


inputs 


;'\' so don't check for cr 




0038 


7e70 


c9 


0d 






cmp 


}$0d 


.•check for cr 




0039 


7e72 


f0 


0a 






beq 


inputs 


,-cr, so end input 




0040 


7e74 


e0 


£a 




inputs 


cpx 


»250 


.-check iE full 




0041 


7e76 


f0 


06 






beq 


inputs 


,-buffer full so quit 




0042 


7e78 


a5 


96 






Ida 


$96 


.-status word 




0043 


7e7a 


29 


40 






and 


t%01000O00 


.-check eoi 




0044 


7e7c 


fO 


el 






beq 


input2 


.-no eoi so continue 




0045 


7e7e 


a9 


22 




inputs 


Ida 


#$22 


;quote 




0046 


7e80 


9d 


7c 


02 




sta 


$027c,x 






0047 


7e83 


e8 








inx 








0048 


7e84 


a9 


3a 






Ida 


»$3a 


.-colon 




0049 


7e86 


9d 


7c 


02 




sta 


$027c,x 






0051 


7e89 


20 


dl 


7£ 




jsr 


varval 


.-assign value 




0052 


7e3c 


20 


76 


00 




jsr 


chrgot 


.-check Eor 




0053 


7e8f 


d0 


cf 






bne 


input4 






0054 


7e91 


4c 


df 


7e 




jmp 


prints 


;input finished 




0056 


7e94 


a9 


00 




inout 


Ida 


l$O0 


.-set status word = 




0057 


7e96 


85 


96 






sta 


$0096 






0058 


7e98 


20 


dl 


ce 


print 


jsr 


ScSdl 


;get byte to .xr 




0059 


7e9b 


86 


d4 






stx 


$d4 


.-pa 




0060 


7e9d 


86 


b0 






stx 


$b0 


;output device number 




0061 


7e9f 


86 


at 






stx 


$af 


.-input device number 




0062 


7eal 


ad 


7b 


02 




Ida 


temp4 


.-check i/o flag 




0063 


7ea4 


£0 


07 






beq 


inout2 


.-output, send listen 




0064 


7ea6 


8a 








txa 




.-put pa into .a 




0065 


leal 


20 


d2 


£0 




jsr 


$f0d2 


;talk addr routine 




0066 


leaa 


18 








clc 








0067 


7eab 


90 


04 






bcc 


print2 


;branch always 




0068 


7ead 


8a 






inout2 


txa 




.-put pa into .a 




0069 


7eae 


20 


d5 


£0 




jsr 


$£0dS 


.-listen addr routine 




007B 


7ebl 


20 


76 


00 


print2 


jsr 


chrgot 


.-check for semicolon 




0071 


7eb4 


c9 


3b 






cmp 


#$3b 







No. 57 - February 1983 



MICRO 



11 



where X is the IEEE-488 device primary 
address (PA], Y is the secondary address 
(SA), and a, b, and c are the variables to 
be output or input. The utility program 
presented here follows this syntax with 
the single change of using a semicolon 
or a backslash in place of the colon. 
(The PET/CBM recognizes the colon as 
a statement separator. ) This syntax has 
the obvious advantage that "logical 
files" are not used: there is no need to 
"OPEN" or "CLOSE" files. The out- 
put has the following syntax: 

PRINT@4,0;"hello there",a,b%,c$ 

This command string sends to the 488 
bus the primary listen address 4 and the 
secondary address (with the 488 ATN 
line set low — true), followed by the 
ASCn string "hello there", the current 
values of the variable a, integer variable 
b%, and string variable c$. A carriage 
return is sent and the 488 bus is cleared 
by an UNLISTEN/UNTALK command. 

If a backslash is used in place of the 
semicolon, a line feed is also sent with 
the carriage return. If a printer with 
device number 4 is coimected, the string 
and variables will be printed. 

The input command has the syntax: 

INPUT@29,24;a$ 

This command string sends the pri- 
mary talk address 29 and the secondary 
address 24. Data is then input to the 
PET/CBM until a carriage return is 
received, the 488 EOI (end or identify) 
line is set low ( = true), or the input 
buffer is full. The data is then assigned 
to the variable a$. There are three fea- 
tures of this syntax that differ from the 
standard PET/CBM INPUT#: no logi- 
cal files are used; the input buffer used 
is located in the tape buffers and is set 
to allow an input of 250 characters in- 
stead of the usual limit of 80 charac- 
ters; and the command can be executed 
not only in a program, but in immedi- 
ate mode. This feature is useful when 
controlling instruments. In addition, if 
a backslash is used in place of the semi- 
colon, the input will not terminate 
when a carriage return is received. Any 
carriage returns will simply be imbed- 
ded in the string variable (in the above 
case, a$]. Of course, numeric variables 
can also be input with INPUT®. In 
these cases the backslash should not be 
used since the carriage return is an il- 
legal character here. 

The Tektronix systems also allow 



Listing 1 (continued) 



0072 
0073 
0074 
0075 
0076 
0077 
0078 
0079 
0080 
0081 
0082 
0083 
0084 
0085 
0086 
0087 

0089 
0090 
0091 

0093 
0094 
0095 
0096 
0097 
0098 
0099 
0100 
0101 
0102 
0103 
0104 

0106 
0107 
0108 
9109 
0110 

0111 
0112 
B113 
0114 
0115 
0116 
B117 
0118 

0120 
0121 
0122 
0123 
0124 
0125 
0126 
0127 

0129 
0130 
0131 
0132 
0133 
0134 
0135 
0136 
0137 
0130 
0139 
0140 
0141 
0142 
0143 
0144 
0145 
0146 

0148 
0149 
0150 
0151 
0152 
0153 
0154 
0155 
0156 
0157 

0159 
0160 
0161 
0162 
0163 
0164 
0165 



7eb6 
7eb8 
7eba 
7ebc 
7ebf 
7ecl 
7ec3 
7ec6 
7ec9 
7ecc 
7ece 
7ed0 
7ed2 
7ed4 
7ed7 
7ed9 



7ee5 
7ee8 
7eea 
7eec 
7eee 
7ef0 
7ef2 
7ef 4 
7ef6 
7ef8 
7efa 
7efd 



7f0b 
7f0d 
7f0f 
7fll 
7fl3 
7fl6 
7fl9 



7fle 
7£21 
7f23 
7f 25 
7f28 
7f2b 
7f2d 
7f2£ 

7f32 
7f35 
7f37 
7f39 
7f 3c 
7£3e 
7£4P 
7£43 
7£45 
7£48 
7£4b 
7£4e 
7£51 
7£51 
7f53 
7£56 
7£58 
7£5b 

7£5e 
7£61 
7£63 
7£66 
7£68 
7£6a 
7£6d 
7£70 
7£72 
7£75 

7£78 
7£7a 
7£7d 
7£80 
7£82 
7£85 
7£87 



£0 0e 
c9 5c 
£0 0a 
20 dl c8 
86 d3 
86 a5 
20 09 £1 
20 48 £1 
20 76 00 
c9 5c 
d0 04 

££ 

10 

ad 7b 02 
d0 87 
20 70 00 



a9 

85 



7edc 20 aa ba 
7ed£ 20 b4 bb 
7ee2 4c fa 7e 



8c 7a 
e6 77 
d0 02 
e6 78 
a0 00 
bl 77 
c9 99 
£0 0a 
c9 85 
£0 09 
ac la 
4c 76 



02 
00 



7£00 a9 00 

7£02 2c 

7£03 a9 22 

7£05 8d 7b 02 

7£08 20 70 00 



c9 40 
£0 85 
c9 21 
£0 06 
20 £7 7£ 
4c £a 7e 
ad 7b 02 



7£lc d0 6e 



00 



20 70 

c9 3b 

£0 31 

20 £7 7£ 

20 dl c8 

86 d4 

a9 00 

20 d7 £0 

20 76 00 
c9 3b 
£0 0a 
20 dl c8 
86 d3 
86 a5 
20 09 £1 
a9 £d 
2d 40 e8 
8d 40 e8 
20 48 £1 
20 70 00 



£B a7 

20 £7 7£ 

a9 02 

0d 40 e8 

Od 40 e8 

20 76 00 
£0 97 
20 70 00 
c9 ab 
£0 0e 
20 £7 7£ 
20 dl c8 
86 a5 
20 09 £1 
4c 5e 7£ 



a9 34 



8d 



11 e8 
c8 



beq atnhi2 
cmp SS5c 
beq atnhi2 
jsr $c8dl 
stx $d3 
stx $a5 
jsr $£109 

atnhi2 jsr $£148 
jsr chrgot 
cmp #$5c 
bne print4 
Ida #$££ 
sta $10 

print4 Ida temp4 
bne lnput4 
jsr chrget 

jsr $baaa 
print3 jsr Sbbb4 
jmp bacbas 

start sty temp3 
inc $77 

bl bne b2 
inc $78 

b2 Idy #$00 

Ida ($77), y 
cmp S$99 
beq b5 
cmp l($85 
beq al 

bacbas Idy temp3 
jmp chrgot 

b5 Ida #$00 
.byte $2c 

al Ida JS22 
sta te(np4 
jsr chrget 

cmp JS40 

beq inout 

cmp 3$21 

beq rbywby 

jsr chrdec 

jmp bacbas 

rbyv;by Ida temp4 

bne rby 



;check £or \ 

;get byte (sa) to .xr 

;sa 

; sa into leee buffer 

;send sa 

;clear atn (high) 

;check £or \ 

;send cr,end input on cr 

;send cr/lf, ignore cr on inp 

;check if input 
; input data 



;send data 

;unl buss, reset i/o 

freturn to basic 

;save y 



;check for print 

; check for input 

/restore y 
;back to basic 

;set output flag 
; dummy op (bit = S2c) 
;set input flag (") 
/store flag 

/check for 9 

/check for 1 

/reset chrget pointer 

/check i/o flag 



wby jsr chrget 

cmp ll$3b 

beq out2 

jsr chrdec 

jsr ScSdl 

stx $d4 

Ida J$0(1 

jsr S£0d7 

jsr chrgot 

cmp }$3b 

beq atnhi 

jsr Sc8dl 

stx $d3 

stx Sa5 

jsr $fl09 

atnhi Ida #$£d 

and $e840 

sta $e840 

jsr $fl48 /atn o£f (high) 

jsr chrget /look past semicolon 
;z flag set if binary zero or colon 

beq bacbas /no bytes to send, bacbas 

jsr chrdec 

out2 Ida 5S02 /set nrfd high again 

ora $ea40 

sta Se042 



/check for semicolon 
/no addr sequence 

get byte to .xr 
prim addr save 
send pa "as is" 
set atn, send pa 

/check for semicolon 

/no s.a. so clear atn 
/get byte ( sa ) to .xr 
/sa store 

/ieee output buffer 
/send byte to ieee 
/set nrfd low 



outbyt jsr chr-jot 
beq bac^'ios 
jsr chr.^et 
cmp JSab 
beq out3 
jsr chrdec 
jsr Sc8dl 
stx Sa5 
jsr Sfl09 
jmp outbyt 



out3 



20 dl 
86 a5 
20 09 fl 
a9 3c 
11 e8 



8d 



Ida t%0011fll0B 

sta $e811 

jsr $c8dl 

stx $a5 

jsr Sfl09 

Ida t%00111100 

sta $e811 



/check for en.i o£ statement 
/ look at next chr 
/check for minus sign 

/reset chrget 
/get byte to .xr 
;to ieee buffer 
/send to ieee 



/bit 3 

/set eoi true 

/get byte 

/send it 
/bit 3 
/reset eoi 



12 



MICRO 



No. 57 - February 1983 



Listing 1 (continued) 












0166 


7f8a 


10 


d2 






b[)l 


outbyt 


/branch always 




0168 


7f8c 


a9 


22 




rby 


Ida 


»S22 


;set up bu££er 




0169 


7f8e 


8d 


7d 


02 




sta 


teinp6 






0170 


7f91 


a9 


3a 






Ida 


J$3a 






0171 


7f93 


8d 


7e 


02 




sta 


temp7 






0172 


7f96 


20 


70 


00 




jsr 


SO070 


;go past (!) 




0173 


7f99 


20 


C0 


£1 




jsr 


Sflc? 


;get byte from leee 




0174 


7f9c 


8d 


7c 


02 




sta 


temp5 


;get unasslgned byte 




0175 


7f9f 


85 


a5 






sta 


$a5 


;copy also to leee buffer 




0176 


7fal 


20 


76 


00 




jsr 


chrgot 


;check chrgot 




0177 


7fa4 


d0 


15 






bne 


rby4 


;no target variable 




0178 


7£a6 


a9 


22 




rby5 


Ida 


J$22 


.-defeat housekeeping 




0179 


7fa8 


8d 


7d 


02 




sta 


tempG 






0180 


7£ab 


aS 


3a 






Ida 


tS3a 






0181 


7fad 


8d 


7e 


32 




sta 


temp7 






0182 


7fb0 


a9 


08 




rby3 


Ida 


»$fl8 


;set ndac high 




0183 


7fb2 


0d 


21 


e8 




ora 


$e321 






al84 


7£b5 


8d 


21 


e8 




sta 


Se821 






0185 


7fb8 


4c 


fa 


7e 




jmp 


bacbas 






0187 


7fbb 


20 


dl 


7£ 


rby<t 


jsr 


varval 






0188 


7£be 


20 


76 


0tl 




jsr 


chrgot 


;check for 




0189 


7fcl 


£0 


e3 






beq 


rbyS 






0190 


7fc3 


20 


70 


00 




jsr 


cfirget 


;go past delimiter 




0191 


7fc6 


20 


C0 


£1 




jsr 


S£lc(i 


;get next byte 




0192 


7£c9 


8d 


7c 


02 




sta 


temps 


;store 




0193 


7£cc 


85 


a5 






sta 


Sa5 






0194 


7£ce 


4c 


bb 


7£ 




jmp 


rby4 


;assign value 




0196 


7£dl 


20 


2b 


cl 


varval 


jsr 


$cl2b 


.-search for variable 




0197 


7fd4 


85 


46 






sta 


$46 


.-returns in .a and .yr 




0198 


7fd6 


84 


47 






sty 


$47 


.-variable pointers 




0199 


7fd8 


a5 


77 






Ida 


$77 






0200 


7£da 


48 








pha 








0201 


7£db 


a5 


78 






Ida 


$78 






0202 


7£dd 


48 








pha 




.-save chrget pointers 




0204 


7£de 


24 


07 






bit 


$07 


;var type, ££=str aa=numeric | 


0205 


7£e0 


30 


03 






bmi 


rby2 


.-str if true.n flag set by 


bit 


0206 


7fe2 


a9 


7c 






Ida 


»$7c 






0207 


7fe4 


2c 








.by 


te $2c 


/dummy op code 




0208 


7£e5 


a9 


7b 




rby2 


Ida 


tS7b 


(Start buffer at quote 




0209 


7£e7 


85 


77 






sta 


$77 






0210 


7£e9 


a9 


02 






Ida 


t$02 


.-change chrget pointers 




0211 


7£eb 


85 


78 






sta 


$78 






0212 


7£ed 








jabove 


val 


jes must 


change if buffer moved 




0214 


7£ed 


20 


3c 


b9 




jsr 


$b93c 


.-assign var value 




0215 


7ff0 


68 








pla 




.-reset chrget 




0216 


7ffl 


85 


78 






sta 


$78 






0217 


7££3 


68 








pla 








0218 


7££4 


85 


77 






sta 


$77 






0219 


7££6 


60 








rts 








0218 


7f£4 


85 


77 






sta 


$77 






0219 


7££5 


60 








rts 








11222 


7f£7 


a5 


77 




chcdec 


Ida 


$77 


;ceset chrget pointer 




[■223 


7££9 


dfi 


02 






bne 


chrdl 






0224 


7££b 


c5 


78 






dec 


$78 






0225 


7££d 


cG 


77 




chrdl 


dec 


$77 






022(; 


7£££ 


60 








cts 









488 bus control on a more primitive 
level using the syntax: 

WBYTE@X,Y:a,b,-c 
RBYTEa.b 

The WBYTE command means " write- 
by te" and is implemented in this pro- 
gram with the syntax: 

PRINT!X,Y;a,b,-c 

For those familiar with Tektronix, this 
command behaves exactly as WBYTE. 
The command sends (with ATN set] 
the absolute primary address of the 
value of X, and the absolute secondary 
address of the value of Y. By 



"absolute," I mean that the address is 
sent as is and is not first converted to a 
talk address (by setting bit 7), or a 
listen address (by setting bit 6). The 
byte variables a, b, and c are then sent 
(without ATN). These one-byte vari- 
ables (or expressions) must have values 
between and 255 to be valid. The 
minus sign before the variable c causes 
the EOI line to be set as this byte is 
sent. Depending on the particular 
device, this may be necessary to signal 
the end of transmission to the ad- 
dressed device. 

Note that the command does not 
send UNLISTEN or UNTALK and the 
addressed device(s) continues to take 
part in transactions on the 488 bus. 



This means that one talker and one or 
more listeners can be set actively on 
the bus with or without the controller 
(the PET/CBM) taking part in the sub- 
sequent data transactions. When the 
process is finished, it may be necessary 
to send UNL/UNT using the command: 

PRINT!63,95; 

This will force all previously addressed 
talkers and listeners off the 488 bus. 

The Tektronix RBYTE command 
means "readbyte" and is exactly im- 
plemented here using the syntax: 

INPUTIa.b 

The use of this command requires that 
a 488 bus device must have been 
previously addressed as a talker (using 
PRINT! (PA), (SA);). Execution of the 
command causes the talker to send a 
single byte whose ASCII value is then 
assigned by the PET/CBM to the 
variable a, and then to send another 
single byte, which will be assigned to 
b. Any number or types of variables 
may be specified and a single byte will 
be input for each. If no variable is 
specified, an unassigned byte will be 
input and placed in location ($00A5] 
where it may be PEEKed if desired. 
Again, the device must be sent UN- 
TALK (PRINT!95;) in order to remove 
it from the bus. 

This command is unlike GET# in 
two important respects: again, no 
logical files are used and INPUT! does 
not send either an address sequence or 
an UNTALK command. The GET# 
command does not allow a talker to 
stay actively on the bus because UN- 
TALK is sent during each execution. 
GET# goes through the addressing 
routine each time before it gets a byte 
from the 488 bus. These two aspects of 
GET# can be merely an inconvenience, 
or an absolute disaster, when attemp- 
ting to use the PET/CBM to control ad- 
vanced instrumentation. With one in- 
strument we have used, GET# caused 
the PET/CBM to receive only every 
third byte sent because of the confusion 
caused by the repeated addressing se- 
quences. INPUT# could not be used 
since more than 80 characters are sent 
without either EOI or a carriage return. 

This utility program mimics the 
I/O procedures used by Tektronix and 
thus allows the PET/CBM to send or 
receive data using the simpler syntax of 
PRINT®; and INPUT®; without 



No. 57 ■ February 1983 



MICRO 



13 



needing "logical files." It also permits 
any single byte to be sent or received 
(with or without ATN) on the 488 bus 
using the syntax of PRINT!; and IN- 
PUT! . More complete control of I/O 
on the IEEE-488 bus allows the 
PET/CBM to be used as a scientific in- 
strument controller in applications 
that are more difficult or impossible 
without this program. 

How to Use the PRINT® 
Utility Piogiam 

An assembler listing [listing 1) and 
BASIC loader program (listing 2) are 
provided for any PET/CBM with 
BASIC 4.0 and 32K. The BASIC pro- 
gram should be entered and run. This 
will load the machine code into top of 
memory, adjust the BASIC pointers to 
protect the code, and attach itself to the 
CHRGET routine. The utility program 
may then be NEWed. Since the 
machine code in this form is not 
relocatable, it should be loaded before 
any other BASIC program. There are 
12 absolute addresses used that must 
be changed if the program is re- 



"■"'CQiUPU $EI\J$Ei:. 



I' 



CARDBOARD 6 
$87.95 

An expansion interface tor ttie VIC-20. 
Allows expansion to 40 K or accepts up 
to six games. May be daisy ctiained for 
more versatility. 

CARDBOARD 3 
$39.95 

Economy expansion interface for 
the VIC-20 

CARD "?" CARD/PRINT 
$79.95 

Universal Centronics Parallel Printer 
Interface for the VIC-20 or CBM-64. 
Use an Epson MX-80 or OKI DATA or 
TANDY or just about any other. 

CARDETTE 
$39.95 

Use any standard cassette player/re- 
corder Vifith your VIC-20 or CBM-64 

CARDRITER 
$39.95 

A light pen with six good programs to 
use Vifith your VIC-20 or CBM-64 



Prices subject to change. 
TO ORDER: P.O. BOX 18765 

WICHITA. KS 67218 
(316) 684-4660 
Personal Checks Accepted (Allow 3 Weeks) 
or C.O.D. (Add $2) Handling Charges $2.00 



assembled for some other location such 
as in an EPROM. 

The four new commands are im- 
plemented using some of the 
PET/CBM ROM routines, but it was 
not possible to use the jump address 
table in ROM since only parts of the 
I/O routines are used. The commands 
support the full syntax error checking 
for variable type and legal values, as 
well as for punctuation. 

When the commands are entered, 
BASIC crunches the PRINT or INPUT 
to the usual tokens ($99 or$85). When 
BASIC executes the commands, the 



utility program tests to see if a PRINT 
or INPUT has been found. If either is 
found then a further test is made to see 
if they are followed by @ or ! and the 
correct routine is then started. If 
neither test succeeds, then control is 
sent back to BASIC. 

(EditoT's note: this approach slows 
down the execution of BASIC programs 
to varying degrees, depending on the 
particular instructions involved. If you 
don't need to use the commands for a 
particular program, it is probably best 
to turn the machine off before loading a 
new BASIC program. 



900 

902 

904 

906 

908 

910 

911 

912 

914 

916 

918 

919 

920 

921 

922 

924 

925 

926 

927 

928 

930 

932 

933 

934 

941 

942 

944 

1000 

1010 

1020 

1030 

1040 

1050 

1060 

1070 

1080 

1090 

1100 

1110 

1120 

1130 

1140 

1150 

1160 

1170 

1180 

1190 

1200 

1210 

1220 

1230 

1240 

1250 

1260 

1270 

1400 

1410 

1420 

1430 



P 
david 



rem 

rem 

rem 

rem 

rem 

rem '@' pu 

rem addres 

rem print? 

rem print? 

rem inputs 

rem input? 

rem 

rem ****** 

rem 

rem print! 

rem 

rem print! 

rem print! 

rem addres 

rem don ' t 

rem 

rem input! 

rem input! 

rem device 

rem 

rem (sa) 

rem 
datal69,l 
datal69,2 
data241,l 
data6,165 
datal24,2 
datal50,3 
data32,21 
datal4,20 
data72,24 
data208,l 
data2,230 
datal33,2 
data2,32, 
data250,l 
datal27,3 
data240,l 
datall2,0 
datal71,2 
datal27,l 
datal41,l 
data64,23 
datal33,l 
data2,169 
data232,7 
datal92,2 
data71,16 
datal33,l 
datal65,l 
restore 
fori=3232 
sys32327 
end 



Listing 2: BASIC Loader 

rintg 4.2 
priddle august 27,1982 



ts atn low, ' ; ' or '\' puts atn high 

ses converted to talk or listen as appropriate 

(pa) , (sa) ;a ,b,c$, . . sends data and cr only 

(pa) , (sa)\a$,b%,c. . sends data and cr/lf 

(pa) , (sa) ;a$ ,b. . . input ends on eoi, buffer full or cr 

(pa) , (sa)\a,b. . . input ignores cr 

(pa) , (sa) ; (bytel) , (byte2) ,-(byte3) .. . minus sets eoi 

(byte-) =expression with value 0-255 
; (bytel).,. allowed if device has been addressed 
; not allowed without either address or datum 
ses sent 'as is' - not converted to talk or listen 
forget to unt/unl the buss 

a input single byte and assign to variable 
a$,b... input single bytes and assign to variables 
must be addressed with ' print ! (pa) , (sa) ; ' first 



is optional in all cases if allowed by device 



26,133,49 
29,133,11 
57,124,2, 
,150,41,6 
,32,209,1 
2,209,200 
0,240,24, 
1,92,240, 
1,32,118, 
35,32,112 
,119,208, 
40,9,172, 
112,0,201 
26,173,12 
2,209,200 
0,32,209, 
,240,175, 
40,14,32, 
69,52,141 
7,232,16, 
2,41,253, 
65,32,118 
,8,13,33, 
6,250,126 
41,141,12 
5,119,72, 
19,169,2, 
19,208,2, 



,133,53 
3,169,1 
232,36, 
4,240,2 
27,32,1 
,134,21 
144,4,1 
10,32,2 
0,201,9 
,0,32,1 
2,230,1 
122,2,7 
,64,240 
3,2,208 
,134,21 
200,134 
32,247, 
247,127 
,17,232 
210,169 
141,64, 
,0,208, 
232,141 
,32,209 
4,2,133 
165,120 
133,120 
198,120 



,169,70 
26,133, 
16,48,4 
31,169, 
18,0,20 
2,134,1 
38,32,2 
09,200, 
2,208,4 
70,186, 
20,160, 
6,118,0 
,133,20 
,94,32, 
2,134,1 
,211,13 
127,32, 
,32,209 
,32,209 
,34,141 
232,32, 
29,169, 
,33,232 
,127,32 
,165,76 
,72,36, 
,32,60, 
,198,11 



,133, 
114,9 
,201, 
34,15 
8,207 
76,13 
13,24 
134,2 
,169, 
32,18 
0,177 
,169, 
1,33, 
112,0 
65,32 
4,165 
118,0 
,200, 
,200, 
,125, 
112,0 
34,14 
,169, 
,118, 
,187, 
7,48, 
185,1 
9,96 



48,13 
6,32, 
13,24 
7,124 
,76,2 
4,175 
0,32, 
11,13 
255,1 
0,187 
,119, 
0,44, 
240,6 
,201, 
,255, 
,32,9 
,240, 
134,1 
134,1 
2,169 
,32,1 
1,125 
2,13, 
0,240 
127,3 
3,169 
4,13 



3,52, 
112,0 
0,10, 
,2,23 
23,12 
,173, 
118,0 
4,165 
33,16 
,76,2 
201,1 
169,3 
,32,2 
59,24 
240,3 
,241, 
167,3 
65,32 
65,32 
,58,1 
92,24 
,2,16 
64,23 
,219, 
2,43, 
,124, 
3,120 



169,7 
,162, 
224,2 
2,169 
6,169 
123,2 
,201, 
,32,9 
,173, 
50,12 
53,24 
4,141 
47,12 
0,46, 
2,118 
32,72 
2,112 
,9,24 
,9,24 
41,12 
1,141 
9,58, 
2,141 
32,11 
193,1 
44,16 
,104, 



6,133 

C,32, 

50,24 

,58,1 

,0,13 

,240, 

59,24 

,241, 

123,2 

6,140 

0,10, 

,123 

7,76 

32,24 

,0,20 

,241, 

,0,20 

1,76, 

1,169 

6,2,1 

,124, 

141,1 

,64 

2,0,3 

33,70 

9,123 

133,1 



,112 

192 



57 

3 

7,138 



32 

,122 
201 



7 

1,59 

32 

1 

78 

,60 

73 

2 

26 

2 
,132 

19,96 



7to32767 : reada :poke (i) ,a;next 



14 



MICRO 



No. 57- February 1983 



Samples of Command Use 

PRINT@4,0;"string",a,b$ 

replaces 

OPEN4,4,0:PRINT#4,"string",a,b$: 
CL0SE4 

INPUT@29,24;X 

replaces 

OPEN10,29,24:INPUT#10,X:CLOSE10 



Idiosynciacies 

While PRINT@3; will correctly 
print to the screen, INPUT@0; may 
not be used to input from the keyboard. 
This aspect of the input was not con- 
sidered important for instrument con- 
trol, but it could probably be changed if 
necessary. 

PRINT!; requires that the user know 
the correct listen or talk address. These 



addresses may be formed by adding 32 or 
64 to the device number. For example: 

PRINT!36,0;65,66,13 
PRINT!;67,68,13 

will cause a printer device number 4 
(listen address 36] to print A B (cr) and 
then C D (cr). ASCD values 65,66,67, 
68, 13 represent A,B,C,D, (cr) . Note that 
the addresses are not sent in the second 
command since the device has not been 
unlistened and is still active on the bus. 
The UNLISTEN is sent using 
PRINT! 63; . 

When you use the INPUT! com- 
mand, remember first to send a talk ad- 
dress using PRINT! (PA); and finally to 
use PRINT!95; to send the UNTALK. 



Mr. Priddle may be contacted at the 
University of Toronto, Department of 
Chemistry, Toronto, Canada M5S lAl. 



IMCftO 



70 INCOME 1AX PROGRAMS 

(For Filing by April 15, 1983) 

For APPLE 11/11* (DOS 3.3, 16-Sector) 



FEATURES: 



1. Menu Driven. 

2. 70+ Tax Programs. 

3. Basic; Unlocl(ed; Listable. 

4. Name/SS No./FS carried 
over. 

5. Inputs can be checl(ed. 

6. Inputs can be changed. 

7. I. R.S. approved REVPROC 
format. 

8. Prints entire Form/Schedule. 

9. Calculates Taxes, etc. 

10. In 3.3 DOS, 16-Sector. 

11. Fast calculations. 

12. Use GREENBAR in triplicate 
— don't change paper all 
season! 

13. Our 4th Year in Tax 
Programs. 

14. We back up our Programs! 



Helpful programs to calculate and print the many Tax 
Forms and Schedules. Ideal for the Tax Preparer, 
C.P.A. and Individuals. For just $24.75 per disk, post- 
paid (in 3.3 DOS; 16-Sector disks). 
Programs are designed for easy-use, with check- 
points to correct parts as needed. Results on screen 
for checking before printing. 

In all, there are more than 70 individual Tax Programs. 
These include Form 1040, 1040A, 1040EZ, 1120, 
1120S, 1041 and 1065. Also Schedules A, B, C, D, E, 
F G, R, RP and SE. And, Forms 1116, 2106, 2119, 
2210, 2440, 3468, 3903, 4255, 4562, 4797, 4835, 
4972, 5695, 6251 and 6252. 
And, vie have a disk m call "THE TAX PREPARER'S 
HELPER" v\(hich has programs for INCOME STATE- 
MENTS, RENTAL STATEMENTS, SUPPORTING STATE- 
MENTS, IRA, ACRS, 1040/ES, ADD W-2's and PRINT 
W-2's. 

TRY ONE DISK AND SEE FOR YOURSELF. ONLY $24.75 
POSTPAID. 

First disk is AP#1, and includes Fomi 1040 and 
Schedules A, B, C, and G. $24.75 POSTPAID. 



1^81 GOOTH TAX PROGRAMS 

931 So. Bemiston • St. Louis, Mo. 63105 



VISA^ 



Announcing 

THE GUIDE 

A Complete Guide 
to the Apple Computer 




If You Own the Original 

What's Where In the 

APPLE? 

You Will Want 

THE GUIDE 
only $9.95* 

The Guide provides full explanatory 
text to lead you tlirougli tlie most 
complete Apple memory map ever 
published! 

The Guide explains and 
demonstrates how to use the atlas 
and gazeteer published in the 
original volume! 

MICRO makes It easy to order 
Send check (payable to MICRO) to: 

MICRO INK 

P.O. Box 6502 

Cholmsfom, MA 01824 

Call our toll-free number: 
1-800-345-8112 

(In PA, 1-800-662-2444) 

VISA and MasterCard accepted 

*Add $2.00 sfiipping per book. 
MA residents add 5%. 



No. 57 - February 1983 



MICRO 



15 




SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS®!* 



I 



tuin?u 5Ef\i5Ei:."' 



VIC-20® 
Personal Computer 
RS232C Interface 
Printer 
Datasette 
Disk Drive 
Expansion Module 
Joystick 
Game Paddles 
Telephone Modem 
Terminal 40 
Produces 40 column output o( information received through the modem 

VIC-1210 VIC 3K Memory Expander Cartridge 

Plugs directly into the VIC'S expansion port. Expands to 8K RAM total. 
VIC-1110 VIC 8K Memory Expander Cartridge 

8K RAM expansion cartridge plugs directly into trie VIC. 

VIC-1011A RS232C Terminal Interface 

Provides mtertace between the VIC-20 and RS232 telecommunications 
Connects to VIC'S user port 



VIC-20® 

VIC-1011A 

VIC-1515 

VIC-1530 

VIC-1540 

VIC-1010 

VIC-1311 

VIC-1312 

VIC-1600 

CM-151 



CM 
CM 



16K Memory Expander 
24K Memory Expander 



179.95 
39.95 

334.95 
67.50 

349.95 

139.95 

9.95 

19.95 

99.95 

29.95 

34.95 

52.50 

39.95 

modems- 

89.95 
110.95 



CARDBOARD 6 $87.95 

An expansion mtertace for the VIC-20 Allows expansion to 40K or accepts up to six 

games. May be daisy chained for more versatility. 

CARDBOARD 3 $29 95 

Economy expansion interface for trie VIC-20. 

CARD "? " CARD/PRINT $79 95 

Universal Centronics Parallel Printer Interface for the VIC-20 or CBM-64 Use an 

Epson MX-80 or OKIOATA or TANDY or just about any other 

CARDETTE $39 95 

Use any standard cassette player/recorder with your VIC-20 or CBM-64. 
CARDRITER $29.95 

A light pen with six good programs to use with your VIC-20 or CBM-64 

BUSINESS &HOMEAPPLICATIONS FOR VIC-20® 



CW-107A Home Calculation Program Pack 

CPV-31 Data Files - your storage is unlimited 

CPV-96 Household Finance Package - to keep records of aii 

your household expenses 
CPV-208 Bar-Chart - display your numerical data 
CH Turtle Graphics - team programming 
CH VIC Forth - is a powerful language lor BASIC programming 
CH HES MON - is a 6502 machine language monitor with 

a mini-assembler 
CH HES Writer - time-saving word processing tool 
CH Encoder - keep your personal records away from prying eyes 
CT-21 Statistics SadiStiCS - statistical analysis 
CT-1 21 Total Time Manager 2.0 - creates personal or 

business schedules 
CT-1 24 TotI Label - a mailing list and label program 
CT-1 25 Tott Text BASIC 

CT-1 26 Research Assistant - keep track of reference data 
CT- 1 40 TotI Text Enhanced 

CM-152 Grafix Designer - design graphic characters 
CQ-5 Mlnjmon - allows you to program, load, save, or execute 
machine language programs 

CT-3 Order Tracker 

CT-4 Business Inventory - to maintain record of inventory 



CPV-210 Bidder 

CPV-217 Cash Flow Model - determine cash flow 

CPV-220 Client Tickler 

CPV-221 Club Lister 

CPV-224 Depredator 

CPV-236 Investment Analyst - keep track ol investments 
and investment opportunitites 

Present Value 
Super Broker 

Syndlcator - calculates whether to buy or sell 
Ticker Tape - maintains investments profile 

Un-Word Processor - screen editor 

Phone Directory - never lose a phone number again 
Checkbook - home utility" program 
Calendar My Appointments - print a calendar 

for every month in any year 

The Budgeter - place your personal finances in order 
HESCOM - transfers data and programs bidirection- 
aliy between VICs at three times the speed of a disk drive 
HESCOUNT - monitors program execution 
HESPLOT - Hi-res graphics subroutines 
Conversions - figures, volume, length, weight, area, 
and velocity to all possible configurations 
The Mail - your complete mail program Cassette 

Disk 

Home Inventory - lists your home belongings 

Check Minder - (V-20 & 64) 

keep your checkbook the right way 
CS General Ledger - a complete general ledger 



CPV-251 

CPV-269 

CPV-270 

CPV-274 

CPV-276 

CPV-286 

CS-111 

CPV-294 

CPV-296 
CPV-327 

CPV-328 

CHV 

CPV-367 

CC 

CS 
CS 



$48.95 
14.95 
30.95 

8.95 
34.95 
49.95 
34.95 

34.95 
34.95 
14.95 
15.95 

13.95 
15.95 
17.50 
29.95 
12.95 
13.95 

15.95 
15.95 
13.95 
12.95 
16.95 
13.95 
9.95 
12.95 

10.95 
12.95 
13.95 
14.95 
16.95 
9.95 
14.95 
14.95 

12.95 
40.95 

19.95 

12.95 

7.95 

24.95 
29.95 
17.95 
14.95 

19.95 



BUSINESS & HOME APPLICATIONS FOR C-64 

CHC-504 HES Writer - word processor $39.95 

CHC-503 Turtle Graphics II - utilizes the full graphics of your 64 49.95 

CHC-502 HESMON - machine language monitor w/mini-assembler 34.95 

CHP-102 6502 Professional Development System 29.95 

CFG Data Files - a management program 27.95 

MANY MORE PROGRAMS FOR YOUR 64 & 20 



COMMODORE SOFTWARE 

VIC-1211A VIC-20 Super Expander $57 99 

Everything Commodore could pack into one cartridge - 3K RAM memory expansion, 
high resolution graphics plotting, color, paint and sound commands. Graphic, text 
multicolor and music modes. 1024x1024 dot screen plotting All commands may be 
typed as new BASIC commands or accessed by hitting one of the VICs special 
function keys. Includes tutorial instruction book Excellent for all programming levels 
VIC-1212 Programmer's Aid Cartridge $45.99 

More than 20 new BASIC commands help new and experienced programmers 
renumber, trace and edit BASIC programs Trace any program line-by-line as it 
executes, pause to edit. Special KEY command lets programmers redefine function 
keys as BASIC commands, subroutines or new commands 
VIC-1213 VICMON Machine Language Monitor $48 99 

Helps machine code programmers write fast efficient 6502 a:^sembly language 
programs Includes one line assembler/disassembler 



GAMES FOR YOUR VIC-20® 
Cribbage 
Motor Mouse 

Avenger Cart. - an invasion of space intruders 
and you're the VIC "Avenger" 

Superstot Cart. - great music and sound effects! 
Super Alien Cart. - you re trapped in a maze 
Jupiter Lander Cart. - pilot your "Jupiter Lander" 

Draw Poker Cart. 

Midnight Drive Cart. - authentic night driving 

Radar Rat Race 

Sky Falling 

Mole Attack - a colorful 'cartoon action" game 

Raid on Ft. Knox - try to escape the guards 

Adventure Land - Formerly available only on larger, 

more expensive computers. All Adventure games are decoded tc 

"talk" on the Type N Talk voice synthesizer (available from VOTRAX) 

Pirate Cove Adventure - yo. ho. ho. & a bottle of rum 31 .95 
Mission Impossible Adventure 

The Count Adventure - trapped in Dracula s castle 
with 3 days to find and destroy the vampire 
CW-1918 Voodoo Castle Adventure - you have to free 
Count Yorga from a curse 

Sargon II Chess - seven challenging play levels 
Gorf - (The smash-hit arcade game!) 
Omega Race - the ultimate space game 
SeaWOlf — an explosive Bally Midway arcade 'classic 
Maze of Mikor - adventure-packed game with 
stunning graphics 

Tank Wars 
Pinball 

Simon - it gets tougher as you get better Great for 

kids of all ages 

Fuel Pirates 

Laser Blitz 

Tank Trap 

Concentration 

Dam Bomber - pilot your plane, avoid enemy fire 
ShamUS - search room after room for the shadow- 
eluding androids, two levels of intense arcade action 

Protector 
Breakout 

Hangman - unbelievable graphics and sound 

Memory - vie challenges your memory 

Match - hand and eye coordination 

Monks - a devilish game of logic 
Bomber - you must decide who you want to fly for. 
then pick a target and your experience level 
Amok - the halls of Amok are populated by robots that 
obey one instruction - get the intruder 
Tank vs. UFO - the tank is moving back and forth 
along the base, shoot the UFO before it shoots you 
Snakman - Pacman for the VIC 
Defender on Tri - you're the pilot of the experimental ship. Defender 
3-D Man - the popular arcade game, requires 3K 

Exterminator - a game luii of bugs 



CCS 
CCD 
CW-1901 

CW-1904 
CW-1906 
CW-1907 
CW-1908 
CW-1909 
CW-1910 
CW-1911 
CW-1912 
CW-1913 
CW-1914 

CW-1915 
CW-1916 
CW-1917 



CW-1919 
CW-1923 
CW-1924 
CW-1937 
CH-G202 

CH-G2C3 
CH-G205 
CH-G206 

CH-G207 
CH-G209 
CH-G210 
CH-G211 
CH-G212 
CH-C307 

CH-C308 

CPU-79 

CPU-85 

CPU-87 

CPU-88 

CPU-89 

CPU-108 

CPU-109 

CPU-153 

CPU-194 



$14.95 
12.99 
24.95 

24.95 
24.95 
24.95 
24.95 
24.95 
24.95 
24.95 
24.95 
24.95 
31.95 



31.95 
31.95 

31.95 

31.95 
31.95 
31.95 
24.95 
15.95 

15.95 
13.45 
13.45 

13.45 
15.95 
15.95 
13.45 
13.45 
34.95 

36.95 
7.95 
9.95 
9 95 
'7.95 
7.95 
9.95 

20.95 

9 95 

14.95 
17.95 
17.95 
20.95 



GAMES FOR YOUR 64 



CCS 
CFC 



Cribbage 
Flight 64 - 



what a program! 



CFC Spright Generator 

Mastermind 
Star Trek 
Black Jack 
Tic-Tac-Toe 
Backgammon 
Maze 64 



Cassette 
Disk 

Cassette 
Disk 



$17.95 
14.95 
16.95 
15.95 
17.95 
19.95 

9,95 
11.95 

7.95 
14.95 
15-95 



Prices subject to change. 
TO ORDER: 
P.O. Box 18765 
Wichita. KS 67218 
(316) 684-4660 
Personal checks accepted (Allow 3 weeks) 
or C.O.D. (Add $2) Handling charges $2.00 

VtC-20® is a registered trademark of Commodore 



(MoMirCQrd) 



I^SSSSSSS«5SSSSSS®=S«SI5S«SSS«SSf*«SJ=^*^^=!=»^^^ 



16 



MICRO 



No. 57 - February 198: 



VIC RS-232 Printer 



by Michael V. Tulloch 



The hardware and software 
needed to interface RS-232 
devices to Commodore's ViC 
computer are described. A Radio 
Shacl( Line Printer VII is used as 
an example. Other examples 
include hardware to convert 
RS-232 voltages to TTL, a BASIC 
program to convert hex code 
data to POKES, a machine- 
language printer driver, and a 
discussion on using a CTS line 
from VIC. 

Printer Driver 

requires: 

VIC-20 

RS-232 printer 
hardware interface 

The Piogiammeis Refeience Guide 
(PRG) is indispensable for understand- 
ing the VIC'S RS-232 implementation. 
Unfortunately, some of the informa- 
tion is misleading. 

Part of PRG's chapter four is 
devoted to the RS-232 interface. 
Although quite versatile, VIC software 
does not implement two RS-232 func- 
tions that may be important with many 
printers. Neither "ring indicator" (RI) 
nor "clear to send" (CTS) is included. 

Unless a printer has a large buffer to 
allow simultaneous data input while 
printing, some handshaking is re- 
quired. The simplest approach involves 
waiting long enough after each output 
to the printer to be sure the printer has 
received, printed, and returned the print 
head. In BASIC this is easily done; from 
the command mode it is not. 

Standard printer handshaking in- 
volves one line. While it is busy, the 
printer sends out a signal on this line. 
The computer reads this busy line and 
holds off further output until the 
printer is free. A busy line usually con- 



nects to RS-232 CTS ~ not used by 
VIC'S software. 

After referring to the VIC PRG and 
considerable experimentation, I deter- 
mined the only way to use the CTS line 
was to write a program to read it directly. 

Hardware 

Another problem, caused by VIC's 
non-standard version of RS-232, in- 
volves voltage levels. VIC outputs to 
+ S volts — TTL levels. VIC also ex- 
pects to -(- 5 volts for any inputs. You 
must observe these limitations since 
the RS-232 lines connect directly to a 
6522 VIA. Because RS-232 standard de- 
vices expect to be sent ±12 volts and 
usually output the same voltage range, 
there is an obvious incompatibility. 

The circuit shown in figure 1 adjusts 
voltage levels. It converts VIC's 5-volt 
signal to ± 12 volts [actually ± 10 volts 
— OK for most applications) and vice 
vetsa. Although, there are several ways 
to accomplish this conversion, the ap- 
proach chosen is capable of isolating 



the VIC completely from the printer if 
the printer supplies the ±12 volts or a 
separate ± 12-volt supply is used. 

A 74LS04 hex inverter protects the 
input and output lines of the RS-232 
port. This inverter also corrects VIC's 
signal inversion problem. An opto- 
isolator shifts the level from 0-5 volts 
to ± 12 volts. 

In this example a single rectifier and 
electrolytic capacitor converts VIC's 
±9-volt ac output to about ±12 volts 
dc. A resistor divider provides a ground 
for the printer. Since RS-232 inputs 
draw very little current, this circuit 
works adequately. Note that the pro- 
tective ground and signal ground of the 
VIC are at the same potential and are 
not isolated. Do not connect either to 
the printer ground. 

The pin connections shown in 
figure 1 are for the Radio Shack printer. 
Note that Radio Shack calls the busy 
line the 'STATUS' line. Any three-wire 
cable will do. if you have an RFI prob- 
lem (and to comply with the new rules 



Figure 1 

R/S Printer 



AV + 



VIC Parallel 
User Port 




DATA 



IC1 Power; 
Pin 7GND 
Pin 14+5 



-12V tL 47 p 

DC T 35V. 11 



VICGND 
CB2 data out 



9V AC 



No. 57 - February 1983 



MICRO 



17 



for Part B computers) use a shielded 
cable. Connect the shield either to the 
printer ground or VIC's protective 
ground {not both!]. 

As an aid to trouble shooting, I in- 
cluded a couple of LEDs. Although they 
increase the cunent required by the cir- 
cuit, they may be helpful in diagnosing 
interfacing problems. Besides, I enjoy 
watching them blink as VIC talks on 
the RS-232 port. 

Although rather primitive, the in- 
terface can be constructed out of junk 
box parts. It's so cheap that even if you 
buy all new parts in five packs at Radio 
Shack, the bill will come to only 
$12.00 (see table 1|. 

VIC uses a 6522 VIA (versatile inter- 
face adapter) for the RS-232 port. The 
same chip also drives the user port. 
Although VIC has two VIAs, we're in- 
terested in chip #1. Memory addresses 
$9119-$911F (37136-37151) access this 
chip. The RS-232 software sets all the 
control registers. Therefore we won't 
have to do it and I'll ignore the process. 
As I've mentioned, however, the CTS 
line is not read by the RS-232 software. 
This line is tied to PB6 [pin K). PB6 is 
one of eight data lines of the B VIA port 
I/O register. The B port register can be 



Table 1: Parts List 






Cost 


iliUsed 


Item 


Radio Shack Part # 


$ 1.98 


2 


Opto- isolators 


276-1628' 


0.79 


1 


74LS04 Hex Inverter 


276-1904 


1.19 


2 


LEDs 


276-032 


0.39 


4 


6.8K Resistor 14 W 


271-1333 


0.39 


3 


IK Resistor WW 


271-1321 


0.10 


1 


56 OHM Resistor 


[Assortment) 


0.49 


1 


1N4001 Diode 


276-1101 


0.69 


1 


47 F 35V Electrolytic 


272-1015 or 272-1026 


2.99 


1 


Edge Connector 
(Cut to 24 pins) 


276-150 or 276-151 


1.49 


1 


4-Pin DIN Plug 


Available some stores 


1.29 


1 


14-Pin DIP Socket 
3-Wire and 6-Wire Cable 


276-1993 


$11.79 (pi 


us tax) tota 


I 




•This part has been discontinued by Radio Shack and 


may not be available in 


all stores. 


Nearly any 


opto-isolator will do. 





read or written to at memory address 
$9110 (37136). 

Normally all VIA pins are either 
defined as outputs or pulled up to 5 
volts. PEEKing the port register should 
yield a value of 255. In other words, all 
pins (outputs and -i-5 volts) are seen as 
logical 1. If pin K is connected to the 



printer's 'busy' line so that the busy 
condition pulls the line to volts, then 
PEEKing $9110 will return a value of 
191 when the printer is busy. To recog- 
nize a busy printer you could read the B 
port and look for a value of 191. 
Printer Driver Software 

As Murphy would have it, things 



EVER WONDER HOW YOUR APPLE II WORKS? 

QUICKTRACE will show you! And it can show you WHY when it doesn't! 

This relocatable program traces and displays the actual machine operations, while it is running and 
without Interfering with those operations. Look at these FEATURES: 



Slngl»-St»p mode displays the last instruction, 

next instruction, registers, flags, stack contents, 
and six user-definable memory locations. 

Trace mode gives a running display of the Single- 
Step information and can be made to stop upon 
encountering any of nine user-definable 
conditions. 

Background mode permits tracing with no display 
until it is desired. Debugged routines run at near 
normal speed until one of the stopping cond- 
itions is met, which causes the program to return 
to Single-Step. 



QUICKTftACC allows changes to the stack, 

registers, stopping conditions, addresses to be 
displayed, and output destinations for all this 
inlormation. All this can be done in Single-Step 
mode while running. 

Two opUonal dimplay tormatm can show a sequence 
of operations at once. Usually, the information 
is given in four lines at the bottom of the screen. 

QUICKTRACE is completely transparent to the 
program being traced.. It will not interfere with 
the stack, program, or I/O. 



QUICKTRACe is relocatable to any free part of 

memory. Its output can be sent to any slot or to 
the screen. 

QUICKTRACe is completely compatible with 

programs using Applesoft and Integer BASICS, 
graphics, and DOS. (Time dependent DOS 
operations can be bypassed.) It will display the 
graphics on the screen while QUICKTRACC is 
alive. 

QUICKTRACC is a beautiful way to show the 

incredibly complex sequence of operations that 
a computer goes through in executing a program 



Prices $S0 

QUICKTRACE was written by John Rogers. 
QUICKTRACE is a trademark 0/ Anthro- Digital, Inc. 



QUICKTRACE requires 3548 (SEOO) bytes (14 pages) of memory and some knowledge of machine language programming. 
It will run on any Apple II or Apple II Plus computer and can be loaded from disk or tape. It is supplied on disk with DOS 3.3. 



QUICKTRACE DEBUGGER 



Latt Ingtructlon 



ConteniB 



Next Inttructlon 



Latt addmtt 

Fi-69- 
ST=7C 

Accumulator 



Top Mwn bym ol ttsck 



DItauambly 

LDA #$AA 



Procattor code< Uter dellned location i Conlentt 



Al 

Xmg. 



43 D4 CI MV-BDIZC 0000^^4C 



y reg. Stack po/ntor Proca$$or atatua Content of roferonced addmsB 

9S Y=^25 SP^=F2 PS==^^ 101 10001 [ ] =DD 



f-F-6B-- 85 



Dlataambly Ralamnca addiatt 

STA $33 [$0033] 



Anthro-Digital, Inc. 

P.O. Box 1385 

Pittsfield, MA 01202 
413^48-8278 



MICRO 



No. 57 ■ February 1983 



aren't entirely that simple. VTC, both 
too smart and too dumb, has a 512-byte 
RS-232 buffer. When printing to the 
RS-232 port, characters go first to the 
buffer. If you don't print more than 512 
characters, the program will continue 
running without waiting for the 
printer. The RS-232 software sends 
characters out simultaneously with 
other VIC functions (except serial port 
and cassette). 

The "too dumb" part involves 
VIC's failure to use the CTS line. In- 
stead you have to handle the busy line 
yourself. My solution to this problem 
gives up the advantages of the printing 
buffer. The machine-language program 
described here only allows characters 
to be output to the buffer at print speed. 
It holds up printing to the buffer while 
the printer returns its print head. This 
slows down RS-232 communications 
considerably, but it works. 

To intercept the characters as they 
are printed to the buffer, the output 
vector at $0326-$0327 (806-807) must 
be changed. For the routine used here 
they must be changed to point to the 
cassette buffer $033C (828) where our 
machine-language program lives. This 
vector can be changed either from 
BASIC or the keyboard. 

POKE 806,60 lo byte 
POKE 807,03 hi byte 

Once you have built the interface 
and an appropriate cable, the next step 
is to interface the software — not a sim- 
ple task. Since I don't have a VIC 
machine- language monitor, I used an 
assembler on my Apple. Listing 1 is the 
resulting assembly code. Liberal com- 
ments are provided, so I'll only briefly 
describe the routine. Two delay loops 
are used. The first loop checks the CTS 
bit until $8F successive checks show it 
has gone high, which means the printer 
is not busy. The second delay executes 
if the last character printed was a car- 
riage return. These two delays assure 
that spaces between characters are not 
misinterpreted and that the routine 
sees the print head return to home. 

Because the listed version uses four 
locations at the top of the VIC's screen, 
you can watch the characters pass to 
the printer and the various timing loops 
perform. The comment section at the 
top of the listing suggests alternative 
storage locations for permanent use. 
Don't worry about the screen scrolling 
— the routine is not affected. 





Listing 1 






















1 












£. 

3 


* 






VIC 


* 










4 


* 


OUTPUT ROUTINE FOR RS- 


-232 * 










5 


%^\I2. 


2 




* 










6 


* 








* 










7 


* 




BY 


« 










8 


:*: 




MICHAEL TULLOCH 












9 


* 




17 AUG 82 


* 










10 


* 








* 










11 


* 


TH.TS ROUTINE USES THE 


CTS * 










12 


* 


LINE WHICH 


IS NOT IMPLIMENTEO* 










13 


* 


BY 


THE VIC 


SOFTWARE. 


* 










14 


* 








* 










15 


* 








* 










16 


* 




NOTES ■■ 


* 










17 


* 








* 










18 


* 


I. 


DIFFERENT PRINTERS MAY * 










19 


* 




REQUIRE 


DIFFERENT 


CNTR * 










20 


* 




VALUES. 




* 










21 


* 


2. 


DIFFERENT DELAY VALUES * 










22 


* 




MAY BE 


NEEDED. 


* 










23 


* 


3. 


LOCATIONS OF SAVA 


SAVX.. * 










24 


* 




FLAG, AND DELAY COUNTER * 










25 


* 




MAY BE 


CHANCED TO 


- 










26 


* 




SAVA EQU *0380 * 










27 


% 




SAVX EQU *03ai » 










28 


* 




FLAG EQU *03S2 * 










25 


* 




DCNTR EQU *0383 * 










30 


* 








* 










31 


* 








* 










32 
33 
34 


«****«****«************«*»*»*»** 














ORG 


«033C 












35 


* 


















36 
37 
38 


* 
* 
SF 


THIS IS THE START OF 


THE CASSETTE BUFFER 










VA 


EQU 


«lE0e 


SAVE ACCUMULATOR 










39 


FLAG 


EQU 


*1E02 


FLAG FOR CR AS LAST CHARACTER 










40 


OUT 


EQU 


«F27A 


REAL CHARACTER OUTPUT 










41 


SfiVX 


EQU 


*1E01 


SAVE X REGISTER 










42 


CNTR 


EQU 


«8F 


EMPIRICAL DELAY BETWEEN SPACES 










43 


OCNTR 


EQU 


«1E01 












44 


BPORT 


EQU 


*9110 


LOCATION OF RS232 CTS REGISTER 


B33C 


80 


00 


IE 


46 






STA 


SAVA 


SAVE ACCUMULATOR 


easF 


8E 


01 


IE 


47 






STX 


SAVX 


SAVE X REGISTER 


0342 


flD 


02 


IE 


4S 






LDfl 


FLAG 


GET THE FLAG 


P345 


C3 


eo 




49 






CMP 


*13 


WAS IT CR 


9347 


F0 


24 




50 






BEQ 


DELAY 


IF SO THEN WAIT A WHILE 


a349 


R9 


00 




51 






LDA 


#9 


NO SO RESET FLAG 


034B 


3D 


02 


IE 


52 






STA 


FLAG 


TO ZERO 


e34E 


1=16 


8F 




53 


RESET 


LDX 


CNTR 


SET UP NUMBER OF TIMES TO LOOK 


a350 


flO 


10 


91 


54 


LOOK 


LDA 


BPORT 


GET THE CTS SIGNAL 


0353 


C9 


BF 




55 






CMP 


#191 


IS IT LOW? 


0355 


FS 


F7 




56 






BED 


RESET 


YES SO START LOOKING ALL OVER 


0357 


CH 






57 






DEX 


NO 


SO DECRIMENT NUMBER OF LOOKS 


035S 


D0 


F6 




58 






BNE 


LOOK 


TAKE ANOTHER LOOK 










59 


* 


FINALLY, ALL LOOKS GOOD 


tS35(=l 


FID 


00 


IE 


60 






LDA 


SAVA 


SO.. RESTORE ACCUMULATOR 


eo5D 


BE 


01 


IE 


61 






LDX 


SAVX 


RESTORE X REGISTER 


0368 


C9 


SO 




62 






CMP 


#13 


IS OUTPUT VALUE A CR? 


0362 


FI3 


03 




63 






BEQ 


FLAGSET 


YES, SO SET FLAG 


0364 


4C 


7H 


F2 


64 
65 


:*: 




JMP 


OUT 


NO SO OUTPUT THE CHARACTER 
DON'T COME BACK 


0367 


80 


02 


IE 


66 


FLAGS 


ET STA 


FLAG 


SET CR FLAG TO 13 < *0D ) 


03iSB 


4C 


7B 


F2 


67 

68 


* 




JMP 


OUT 


SET, SO OUTPUT THE CHARACTER, 
DON'T COME BACK 


13360 


fl3 


FF 




69 


DELAY 


LDA 


««FF 


MAKE IT A LONG DELAY 


a36F 


80 


01 


IE 


70 






STA 


OCNTR 


SAVE ACCUMULATOR AT TOP OF SCREEN 


0372 


fl2 


FF 




71 


XS 


TRT 


LDX 


«*FF 


MAKE IT A REALLY LONG DELAY 


0374 


Cfl 






72 


XDEC 


OEX 


START 


COUNTING OUT 


0375 


00 


FD 




73 
74 


* 




ONE 


XDEC 


IF X IS NOT ZERO THEN 
DECRIMENT SOME MORE 


0377 


CE 


SI 


IE 


73 






DEC 


DCNTR 


DECRIMENT THE OUTSIDE COUNTER 


037fl 


00 


F6 




76 






BNE 


XSTRT 


IF NOT 00 INNER LOOP AGAIN 


e37C 


4C 


49 


03 


77 






JMP 


«0349 


DONE AT LAST RETURN FROM DELAY 



To make entering the machine-lan- 
guage program easier I wrote the BASIC 
program in listing 2. Note that the data 
statements contain the code in hex. 
The program reads the hex data and 
converts it into decimal numbers. It 
also reads the start address from a data 
statement, then POKEs the data into 
successive memory locations. By re- 
moving lines 150 and 160 and changing 
the data in lines 5-17, this program will 
convert and enter any hex code se- 
quence. For those of you who don't 
have VICMon, this is easier than con- 



verting hex to decimal and typing it in 
as data or typing a lot of POKEs. 

Using the programs is easy; just 
follow these instructions: 

1. Enter the BASIC program. 

2. SAVE the BASIC program. 

3. RUN the BASIC program. 

4. Either from the keyboard or from 
within a program, 

OPEN2,2,3,CHR$(7) + CHR$(0) 

5. To LIST to an RS-232 printer 
CMD2 



No. 57 - February 1983 



MICRO 



19 



Listing 2 



I GOTO lee 

5 DHTH 828' REM START OF CHSETTE SUFFER 
9 REM. 

9 REM MfiCHINE LflNCUHCE PROGRAM FIS HEX DflTfl 

10 DHTH 8D,02,lE,8E-01.1E.HD,02,lE,C3<0D.F0,24,H9,0e 

II DHTfl 8D.02,lE.H6;8F.HD,lB,91.C9,BF,F0,F7,Cfl,DB,F6 

12 DHTfi FiD.00-lE,HE.ai.lE,C9,0D/F0.03.4C.7H.F2/SD-02.1E..4C.7H,F2.Fl9,FF,8D.04.1E 

13 DflTfl fl2-FF,CFI,Da,FD.CE.a4,lE.D0,F6.4C.49,03 

17 DHTH END 

18 REM ***** END DFITFI ***** 

19 REM HEX TO DECIMAL SUBROUTINE 

20 READ M'lF Fi«-"END" THEN 98 

25 IF LEN<Fi«>»lTHEN 40 : REM JUST ONE BIT SO SKIP HI BIT STUFF 

30 fil*»LEFT*<fl*, D'COSUe S0'H»VflL<fil*)'REM DO HI BIT 

40 H1*»RICHT«<FI«,1)-G0SUB e0'S=VFIL<Fll«>-REM DO LO BIT 

50 V«<fl*16>+B'REM MAKE IT BASE TEN 

70 fl"0-B-a'REM KEP IT CLEAN 

75 RETURN 

79 REM CHANCE LETTERS TO NUMBERS SUBROUTINE 

80 IF VAL<A1*>>0 THEN RETURN 'REM IT IS A NUMBER 

82 IF A1«»"0" THEN RETURN ' REM IT IS A ZERO 

83 REM IT WASN'T A NUMBER SO IT MUST BE A LETTER 

84 Z»ASC<A1«)' REM CHANGE TO A NUMBER 

86 A1«"STR«<Z-55>'REM MAKE NUMBER 10 TO 15 
90 REM A NEAT TRICK TO CONVERT A-F TO 10-15 

98 RETURN 

99 REM ************* MAIN ************* 

100 REM POKE THE MACHINE LANGUAGE 

110 READ S'REM GET THE STARTING MEMORY LOCATION 

120 GOSUB 20' REM CHANCE HEX TO BASE TEN 

130 POKE S,V'REM DO IT 

135 PRINTS/ViREM SO WE CAN SEE IT 

137 S-S+1'REM INCRIMENT THE MEMORY LOCATION 

138 V=0 

140 IF A«<>"END" THEN 120 

150 P0KE36e79.8'REM MAKE SCREEN BLACK SO WE CRN SEE IT WORK 

160 POKE 306,6e'POKEe07,03'REM SET THE OUT PUT VECTOR TO ROUTINE 

190 END 



LIST 

PRINT#2 

CLOSE 2 

RUN/STOP - RESTORE 
Remember to PRINT# before 
CLOSEing the RS-232 channel. If the 
busy line goes low and stays there, the 
system will hang. If you unsuccessfully 
try to run/ Stop-restore, you may have a 
printer problem. Good luck and happy 
PRINT#ing! 

References 

1. Butterfield, J. and Law, Jim, Com- 
pute!, Vol. 4, No. 8, August 1982, 
p. 99. 

2. Finkel, A., et. al., Piogiammei' s 
Reference Guide, Commodore Busi- 
ness Machines, 1982. 

3. Lesea, A. and Zaks, R., Micio- 
pwcessoT Inteifacing Techniques, 
Sybex, Berkeley, CA, 1977. 



Michael Tulloch is a consultant in 
engineering psychology and president of 
Intelligent Home Systems, Inc. He may be 
contacted at Intelligent Home Systems, 
Inc., P.O. Box 0858, Roswell, GA 30077. 



JMCRO 



QCB-9 SINGLE BOARD COMPUTER 

$149.00 

•PARTIAL KIT 



• 6809 BASED 

• RUNS TSC FLEX DOS 

• QCB-9/1 S-100 BUS 

• QCB-9/2 SS-50 BUS 



FEATURES 




• 5V4" Floppy Controller 

• Serial RS-232 Port 

• Centronics Type Printer Port 

• Keyboard /Parallel Port 

• 24K Bytes o( Memory 

• QBUG Resident Monitor 

• 6802 Adaptor 

FULLY ASSEMBLED 

& TESTED $389.00 

• 48-hour Burn-In 

• 90 Day Warranty 



NAKED-09 SS-50 6809 CPU CARD $49.95* 

♦ IKOFRAM ATE400 Assembled & Tested $149.00 oocu'ronfaiion 

♦ 6K OF EPflOM AT E800-FFFF 2 MHZ Version $189.00 Only 

♦ HIGH QUALITY DOUBLE SIDED PCB * SOLDER MASKED « SILK SCREENED 



TSC, FLEX DOS, ASSEMBLER, EDITOR 



$150.00 



$50.00 

■k Break Points 

* Jump ta User Program 

* Register Display & Change 



QBUG RESIDENT MONITOR 

* Disc Soot « Memoiy Test 
« Memory Exam & Exchange * Zero Memoiy 

* Memory Dump « Fill Memoiy 

QBUG IS A TRADEMARK OF LOGICAL DEVICES INC., " Copyright 1981 

PHONE ORDERS: (305) 776-5870 

LOGICAL DEVICES INC. 

COMPUTER PRODUCTS DIVISION 
781 W. OAKLAND PARK BLVD. • FT. LAUDERDALE, FL 33311 

TWX: 510-955-949S • WE ACCEPT VISA, MC, CHECKS, C.O.D., MONEY ORDER 




PREMIER 



ISSUE 




ommanaer 



THE MONTHLY JOURNAL FOR 
COMMODORE 

COMPUTER USERS 
^.^0 64 PBV^ 

MAX MACHINE 

'COMMANDVi ujiU bt dtdicat^d to communicatinq fh* /un of. as w*lt as f>>« 
tatnt information about fh* COMMODORE COMPUTERS.' 

GET YOUR MONEY'S WORTH 

You'v« probably mad« a sizeable investment in your computer 
equipment. COMMANDER can help you make the most o( it. Each 
issue brings you the no-nonsense advice you need to stay on (he 
leading edge of this constantly changing field. COMMANDER will be 
your reference source to the world of computers with the best, most 
comprehensive coverage you can get!! 
PREMIER ISSUE Q 1 YR. 122 Q J YR. no a 3 YR. 15* 

u Disrni INT iPitiCES do not ihclum m oiscoutrr) 

COMMANDER 

S<jl>mcnplion Ortlmn On^ PC BOX 98827 

To» Fr.. Numlxr l-S00-(2«-IU0 TACOMA. WASHINGTON 9«49« 

Kxm WA. HI AMI (206) S65-M14 



20 



MICRO 



No. 57 ■ February 1983 



INDUSTRIAL CONTROL MICROCOMPUTERS 



f 

«. 


r flH^^nHBHH'^fliHiHsl^l^^l 


^^■£^1 


r> ^ 


CS' 


1 


IK 


^ ^flnliinlnKi^^Siiil 


m^^^^^M 


B 


II'- 




^^Fj^U 




- 'a 




^'?;^^S 


^■■A 
n 


■■ii 


r 



wvr^^^jm 



6502 AND Z80 
MICROCOMPUTERS 

ARE DEDICATED COM- 
PUTERS DESIGNED FOR 
CONTROL FUNCTIONS. 

THESE BOARDS FEATURE: 

• 4096 BYTES EPROM 

• 1024 BYTES RAM 

• ALL BOARDS 
INCLUDE COMPLETE 
DOCUMENTATION 

• 50 PIN CONNECTOR 
INCLUDED 

• EPROM AVAILABLE 
SEPARATELY 




JOHN BELL ENGINEERING'S 6502 
MICROCOMPUTER FEATURES: 

• 1024 BYTES RAM 

• 4096 BYTES EPROM 

• USES ONE 6522 VIA (DOC INCL) 

• 2 8 BIT BIDIRECTIONAL I/O PORTS 

• 2 16 BIT PROGRAMMABLE TIMER/ 

COUNTERS 

• SERIAL DATA PORT 

• LATCHED I/O WITH HANDSHAKING LOGIC 

• TTL AND CMOS COMPATIBLE 



80-1 53A 

EPROM NOT INCLUDED 



LIST 100-499 
S110.95 S66.57 



JOHN BELL ENGINEERING'S NEW Z80 
MICROCOMPUTER FEATURES: 

• Z80 CPU-SOFT\";ARE COMPATIBLE WITH 
Z80. 8080 AND 8085 MICROPROCESSORS 

• 4096 BYTES EPROM 

• 1024 BYTES RAM 

• SINGLE W POWER SUPPLY AT 300MA 
- CLOCK FREQUENCY IS 2MHZ, RC 

CONTROLLED 

• ZSf'PIOiDOr INCL. 

• 2 8-BIT BIDIRECTIONAL I/O PORTS 

• LATCHED I/O WITH HANDSHAKING LOGIC 

• TTL AND CMOS COMPATIBLE 



80-280A 

EPROM NOT INCLUDED 



LIST 100-499 
SI 29.95 $77.97 



USE YOUR 6502 OR Z80 MICROCOMPUTER TO CONTROL EVERYTHING! 



YOUR HOME SECURITY SYSTEM 

HEAT CONTROL 

LIGHT CONTROL 

SOLAR HEATING AND POWER SYSTEMS 

AUTOMATIC CONTROL OF TAPE 

RECORDERS 

TRAFFIC LIGHT CONTROL 

IRRIGATION SYSTEMS 



AUTOMATIC CONTROL OF VIDEO 

RECORDERS 

ROBOT CONTROL 

AUTOMATIC DIALER 

AUTOMATED SLIDE SHOW CONTROL 

COMMUNICATION SYSTEMS FOR THE 

DISABLED 

THE WORLD 



•JoHiv Bei.i. Exoiivioeriivo, Ixc. 



ALL PRODUCTS ARE A VAILABLE FRCf.1 JOHN 5ELL,.^^!N^^-^!Nt? 



^^^^^Qi 



ADD SALES TAX IN CALIFORNIA 
SEND $1.00 FOR CATALOG 



ADD 5% §1 

(415)592-8411 

WILL CALL HOURS: 9am-4pm 



INC. • 1. . 4 CENTER ST., SAN CARLOS, CA 94070 
'G & HANDLING 3% FOR ORDERS OVER $100 
10% OUTSIDE U.S.A. 
ADD $1.50 FORC.O.D. 



#300 



No. 57 - February 1983 



MICRO 



21 



PROM BASIC for the C I P 



by David A. Jones 



This article describes a unique 
way to increase the performance 
of the Superboard II/C1P without 
a disl( interface and drive. The 
modifications are for the user 
who wishes to dedicate his 
system to oniy a few specific 
tasi(S that are run often, or who 
is Inexperienced in the use of 
sophisticated computers. 

PROI\A BASIC 

requires: 

C1P 

As an alternative to upgrading a 
cassette-based system to disk where 
improved performance is attained at a 
considerable price, I would like to share 
my ideas on a PROM BASIC system. 
Even with the general decline of com- 
puter hardware prices, adding a disk to 
my CIP would cost twice the original 
investment. The alternative I refer to is 
EPROMs. 2732 EPROMs are available 
for approximately $10 apiece, so for 
less than $100 you can buy eight 
EPROMs, a 24-pin ZIP connector, a 
couple of 74LS139 decoders, and still 
have enough left over to pay the sales tax. 

There have been several articles in 
MICRO (39:97 and 45:31, for example) 
to expand the 600 board via the Jl con- 
nector. I won't go into detail here ex- 
cept to say I limited my memory ex- 
pansion to 24-pin devices. The byte- 
wide RAM parts are now more cost ef- 
fective than 2114's when you consider 
the price of sockets and power dissipa- 
tion, and they have the added advan- 
tage of being pin-compatible with 2716 
and 2732 EPROMs. 

An expansion board with eight 
24-pin sockets will utilize all of the 
generally available unused memory in 
the 600 board if populated with 2732 
EPROMs, or half of that amount if 



Listing 1 



10 


0000 






;8UT0B8SIC, 


II -2-31 


26 


0000 






;ev 


08VI0 8 


. JONES 


38 


0000 






_; 






40 


97R0 






*=$9788 




50 


97fi0 






VTMF 


=*F8 




60 


97ft8 






800R 


=$FC 




70 


9780 






VTNF 


=$FE 




80 


97fi0 






XTMF 


=*FF 




90 


97fi0 






IVEC 


=i02IS 


100 


S7m 






WftRM =$8274 


110 


97a0 






LEG8L =$FE93 


120 


97FI0 






R0L8 =*FE08 


130 


97m 






INPUT =*FEEO 


148 


97B0 






B8S0UT=tFFEE 


150 


97fi0 






; 






160 


97FI0 


R92fl 




L08 


#-* 


FRONPT 


170 


97ft2 


20EEFF 




JSR 


B8S0UT 




180 


97fi5 


8204 




LPX 


»4 




190 


9787 


20EOFE 


INNN 


JSR 


INPUT 


GET 800RESS <4 HEX OIGITS) 


200 


97aft 


20EEFF 




JSR 


B850UT 




210 


97FI0 


2093FE 




JSR 


LE(j8L 


HEX CHRR8CTER ? 


220 


97B0 


86FF 




STK 


XTMP 




230 


97B2 


8200 




LOX 


*0 




240 


97B4 


20O8FE 




JSR 


R0L8 


ROLL IT INTO 800RESS REGIS 


258 


97B7 


mFF 




LOX 


XTHP 




268 


97B9 


Cfl 




OEX 






270 


97Bft 


O0EB 




BNE 


INNN 


GET REST OF 800RESS 


280 


97BC 






; 






298 


97BC 


801802 




L08 


IVEC 


S8VE INPUT VECTOR 


308 


97BF 


S5F8 




ST8 


VTtlP 




310 


97C 1 


801902 




L08 


IVEC+I 




320 


97C4 


85FB 




ST8 


VTMP+I 




330 


97C6 












348 


97C6 


R00897 




L08 


MOVE+ 1 


SET INPUT VECTOR 


350 


97C9 


801802 




ST8 


IVEC 




368 


97CC 


8D0B97 




L08 


nOVE+2 




370 


97CF 


801902 




S18 


IVEC+I 




380 


97P2 


8080 




LOV 


#(3 




398 


9704 


S4FE 




STV 


VTftP 


PRESET V REGISTER 


480 


97D6 






; 






418 


9706 


4C7482 




JNP 


U8RI1 




428 


9709 












430 


9709 






: 






440 


9709 


4C0C97 


MOVE 


JHP 


L080 




458 


970C 


84FE 


L080 


LOV 


VTNP 


LORO PROGRRM FROM PRO/1 


468 


970E 


BIFC 




L08 


(800R), 


V 


478 


97E0 


C999 




CMP 


#$99 


ENO OF FILE ? 


480 


97E2 


F008 




BEQ 


OUT 




490 


97 E4 


CS 




INV 






500 


97E5 


S4FE 




STV 


VTMP 




518 


97E7 


0002 




BNE 


RETN 




520 


97E9 


E6F0 




INC 


800R+ 1 


NEXT BLOCK 


538 


97 EB 


60 


RETN 


RTS 






540 


97EC 






; 






550 


97 EC 


85F8 


OUT 


L08 


VTNP 


RESET VECTOR 


560 


97EE 


8DI802 




ST8 


IVEC 




570 


97FI 


85FB 




L08 


VTtlP* 1 




580 


97F3 


SO 1902 




ST8 


IVEC+I 




590 


97F6 






,,' 






680 


97F6 


4C7482 




JMP 


H8RM 




618 


97F9 






; 




(c 



(continued) 



22 



MICRO 



No. 57 - February 1983 



HM6116 or TMM2016 RAMs are used. 
I chose a mixture of 4K RAM and 24K 
EPROM, which works well for a 
cassette-based system. 

I originally built my expansion in- 
terface to house the Assembler/Editor 
and Extended Monitor in EPROM so 
they always would be available im- 
mediately. I wired in extra sockets so I 
could do the same with some 
assembly-language games for my 
children. I figured if video games have 
programs in cartridge packs so can my 
CI P. The Assembler and Extended 
Monitor are now as accessible as ROM 
BASIC. The Extended Monitor can be 
run directly from PROM, but since the 
Assembler/ Editor has self-modifying 
code it must be moved to RAM to run. I 
wrote a short routine to do this 
automatically when I call the program. 
The response is instantaneous. 

The next logical question was, if I 
can do it with machine-language pro- 
grams, why not BASIC programs also? 
Some obvious answers are that BASIC 
programs are stored in token form, they 
tend to occupy more memory, they de- 
pend upon pointers in page zero that are 
set when the program is loaded, and 
these pointers are modified as the pro- 
gram runs. None of these reasons seemed 
insurmountable, although they were 
not without challenge. 

I tried storing page zero along with 
the tokenized program and then load- 
ing both into RAM when I wanted the 
program. A problem occurred since my 
storing and loading routines also used 
page zero and therefore modified what I 
wanted to save. Also, storing page zero 
required 256 more bytes of storage and 
more complicated code to handle it 
unless page two and three were stored, 
which used still more space. 

This method worked, but I decided 
to try another tack — emulating a load 
from the serial port. The advantage of 
this procedure is that you don't have to 
use page zero and the application pro- 
gram can be stored in ASCII rather than 
token form. Two or more programs can 
be chained, or program and data can be 
loaded independently. My word pro- 
cessor is in BASIC so I must retain this 
capability. The disadvantage is that 
ASCII takes more storage space. How- 
ever, for moderate sized programs I find 
not storing page zero makes the trade- 
off acceptable. 

To load a program from EPROM, a 
three-part machine-language routine 
(listing 1) is called from BASIC via the 











Listing 2 


16 eciee 






i STORE, l-l 


-82 


2d eeee 






iBV 


ORVID R 


. JONES 


30 9600 






*=$9600 




40 9600 






,; 






50 9600 






flENC 


=$86 


END OF MEMORV.. HIGH ADDRESS BVTE 


60 9600 






STOH 


=$F0 


STORE POINTER.. 2 LOCATIONS 


70 9600 






VTMF =$FE 


TEMPORFIRV STORE FOR V REGISTBR 


S0 9600 






LFLG =$020 


3 BFISIC LORD FLFIG 


90 9600 






FLAG =$0390 mOE FLAG 


100 9600 






BFISIN =$FFEB INPUT ROUTINE 


1 10 9600 






BftSOUT=$FFEE OUTPUT ROUTINE 


120 9600 






.; 






130 9600 


H003 


5ETP 


LOV 


#$03 


SET STORE POINTER 


140 9602 


S4FI 




STV 


STOR+I 




150 9604 


H000 




LDV 


#0 




160 9606 


S4F0 




STV 


STOR 




170 960S 






i 






tS0 960S 


20EBFF 


CHECK 


JSR 


BFISIN 


GET CHFiR FROM KEVBORRD 


190 960B 


C94C 




CMP 


#'L 


CHECK FOR L TO SWRT LORD 


200 960D 


D0F9 




BNE 


CHECK 


IF NOT KEEP LOOPING 


2(0 960F 


SO90O3 




5TR 


FLFIG 


DISPLRV FLRG 


220 9612 


l^9FF 




LOR 


#$FF 




230 9614 


SD0302 




STB 


LFLG 


SET BRSIC LORD FLRG 


240 9617 






i 






250 9617 


20EBFF 


IN 


JSR 


Bi^SIN 


GET CHRP FROM RCIR 


260 96 m 


C900 




CMP 


#0 


DON'T STORE NULLS 


270 96 IC 


F0F9 




BEO 


IN 




2S0 96 IE 


20EEFF 




JSR 


BRSOUT 


DISPLRV CHRRRCTER ON CRT 


290 9621 


S4FE 




STV 


VTMP 


SRVE V 


300 9623 


R000 




LOV 


#0 




310 9625 


9IF0 




STFI 


<STOR>, 


V STORE CHRRRCTER 


320 9627 


E6Fe 




INC 


STOR 




330 9629 


D008 




BNE 


RETN 




340 962B 


E6FI 




INC 


STOR+I 


INCREMENT BLOCK IN MEMORV 


350 9620 


R5FI 




LOft 


STOR+I 




360 962F 


C5S6 




ChP 


MENC' 


END OF MEMORV ? 


370 9631 


F005 




BEQ 


OVER 




3S0 9633 


R4FE 


RETN 


LOV 


VTMP 


RECRLL V 


390 9635 


4CI796 




JMP 


IN 


GET NEXT CHRRRCTER 


400 9638 






; 






410 963S 


ft94F 


OVER 


LDFI 


#'0 


OISFLRV OVERFLOW FLRG 


420 963R 


SO90O3 




S7fl 


FLAG 


ON 25TH LINE 


430 96 3D 


20EBFF 




JSR 


BRSIN 


GET NEXT CHRRRCTER 


440 9640 


S09203 




S7fl 


FLfiG+2 


DISPLRV ON 25TH LINE ONLV 


450 9643 


4C3S96 




JMP 


OVER 


LOOP UNTIL BRERK 


460 9646 






' 







USR(X) function. POKE 11,160:POKE 
12,151:X = USR|X) for the addresses in 
listing 1. Once called, this routine 
changes the input vector to point to the 
second part of the routine. The second 
part feeds data to the BASIC load rou- 
tine just as if it were coming from the 
serial port or keyboard. A check is 
made to see if the data contains a $99, 
which indicates the end of the load and, 
if so, the input vectors are reset to their 
original value by part 3. Then it jumps 
back to BASIC warm start. This routine 
allows the stored program to be located 
anywhere in memory and prompts the 
user with an asterisk ('). The user 
responds with the starting address. 

Storing the program in EPROM is 
more complicated but by no means dif- 
ficult once you imderstand the concept. 
Also, you must have access to an 
EPROM programmer. 

First, be sure the program to be 
stored is thoroughly debugged and user 
friendly. Remove REM statements and, 
if you want, pack code to save memory. 



Save the resulting code on cassette tape 
and load the program back into mem- 
ory with the routine in listing 2. The 
file is now stored in a straight ASCII 
format with no tokens. Find the end of 
the file, delete the OK, and insert a $99. 
The last available RAM location is 
stored by BASIC cold start in locations 
$85 and $86. When storing, the routine 
checks for the end of RAM and displays 
the overflow flag if the end is reached. 
No more loading occurs but all further 
incoming data is displayed on the 25th 
line. Depressing the space bar ter- 
minates cassette input and reverts back 
to the keyboard for input. Anything 
typed now will be stored in the next 
location. At this point you should 
break to the monitor and call your 
EPROM loading routine. I use my 
smart terminal program to perform the 
storage function, but since the hooks 
are unique to my system, I mention 
only the following: transfer the 
memory image to your EPROM pro- 
grammer and program the EPROM. I do 



No. 57 - February 1983 



MICRO 



23 



this with my machine-code file-save 
routine. This often is called the OSI 
checksum format but is really the MOS 
Technology Binary Loader, which is 
recognized by many commercial PROM 
programmers. The OSI Extended Moni- 
tor calls this the SAVE routine. 

You may wonder why you should 
go to all this trouble when a disk offers 
more versatility. Some reasons are: 
cost, speed (a 3K BASIC program takes 
3 minutes and 14 seconds — EPROM 
takes 13 seconds], ease of operation for 
novice users, absence of mechanical 
transports, the fact that the program is 
generally crashproof and quickly re- 
covers if a crash occurs, and the need 
for less desk space and interface cables. 

Some of the programs I find useful 
to have in EPROM (in addition to 
games) are a renumber utility, a word 
processor, a stock market monitor with 
a cassette data base that I update each 
week, and brief programs I might want 
on short notice. I installed a ZIP con- 
nector at location $4000 to facilitate 
changing PROMs. 

You could, of course, have a com- 
pletely dedicated system with PROMs 



as the only mass storage media. Such a 
system could be used in a process con- 
trol environment or office that con- 
stantly uses the same set of programs 
day after day with no changes. The 
system could be programmed to boot 
and call a menu on power up. Changing 
the output vector to load the program 
without displaying it would speed up 
the loading process by about 50% — 
three or four seconds versus seven or 
eight seconds for a 4K program — and 
would be more asthetically pleasing to 
a non-computer professional. 

For the do-it-yourselfer, three 
sources of EPROM programmer kits are 
listed here: 

1. Micro Technical Products, Mesa, 
Arizona, $45.00 - kit, $15.00 - bare 
board, documentation and software. 

2. John Bell Engineering, Redwood 
City, California, $39.95 - kit, $24.95 
- bare board only. 

3. Aardvark Technical Services, Walled 
Lake, Michigan, $75.00 - assembled 
and tested, $24.95 - bare board only. 

Although the Aardvark board is the 
most expensive, it is designed 
specifically for the 600 board. The John 



Bell board is for the Apple but can be 
coaxed to work with any 6502 system. 
The Micro Tech unit is a general- 
purpose board and is the one I ordered. 

Other Methods 

You can double the ROM/PROM 
capacity of the 600 board with or with- 
out the Jl connector. BASIC-in-ROM is 
stored in four 2316's which are 2K by 
8-bit 24-pin ROMs in U9, UIO, Ull, 
and U12. Replacing these with 4K by 
8-bit 2732 EPROMs doubles the storage 
capacity for a total of 16K available at 
these physical locations. The extra ad- 
dress decoding needed to support the 
additional 8K of EPROM requires only 
one 74LS139 IC and can be installed in 
one of the proto locations. 

Assigning addresses $8000-$9FFF to 
the newly installed memory works 
well with existing usage and minimizes 
the possibility of conflict if you decide 
to add the 610 board later. BASIC-in- 
ROM starts at $A000; i.e., $9FFF-(- 1. 

Now that you have this extra 
memory available, how can you use it 
to best advantage? Relocating the Ex- 
tended Monitor to $9800-$9FFF keeps 



Scotch' Diskettes 



record reliability 



Scotch 3M 

diskettes 




at the lowest price! 



Call our Modem Hotline (anytime) - 619-268-4488 
for exclusive monthly specials. Our tree catalog 
contains more ttian 600 fantastic values. 

ABC Data Products 



8868 CLAIREMONT MESA BLVD. 
SAN DIEGO, CALIFORNIA 92123 

ORDERSONLY ITTTELEX INFORMATION 
800-850-1555 4992217 619-268-3537 



CSE means OSI 

Software and Hardware 
Specializing in C1P and C4P machines 



Basic Load/SAVE: 
Employs token loader system. 50-100% faster 

than the old indirect ASCII system. Maintains a 

listing of file names found on the tape 

C1P $10.95 

C4P $19.95* 

Basic Enhancer: 

Renumber, Auto Sequencer, Screen Control func- 
tions, and tape I/O system that is faster and has file 
names 

C1P $21.95 

C4P $29.95* 

*comes with required modified monitor Rom chip 



NEW! NEW! NEW! 

ANCHOR SIGNALMAN MODEMS 



.$95.00 



Please write for more info on new disk programs or 
send $2.00 for catalog. Please include $2.00 shipping 
($4.00 for modems). 



Computer 

Science 

Engineering 




Box 50 • 291 Huntington Ave. Boston 02115 



24 



MICRO 



No. 57 • February 198; 



it out of the user memory area and 
allows it to co-reside with the Assem- 
bler/Editor, increasing its usefulness. 
You can now jump back and forth be- 
tween the Extended Monitor and the 
Assembler/Editor at will without 
reloading either program or source 
code. This makes debugging easy. 

Since the original Extended Monitor 
resides in memory from $0800-$0FFF, 
the offset is exactly $9000, simplifying 
cross references to the original. A table 
located at $0960-$0999 is used to 
decode the monitor command and 
jumps to the selected routine. When 
you relocate the code, this table must 
be modified manually by adding the 
offset to every odd location within the 
table; i.e., $B30B becomes $B39B — 
the new jump address for the 'A' com- 
mand at $0962,0963. The Monitor is 
now entered at $9800 and no user RAM 
is employed (page zero excepted). 

I located the Assembler/Editor 
storage from $8040 to $9191. The 
Assembler/Editor uses self-modifying 
code and must be resident in RAM 
memory to run. I use the routine in 
listing 3 to move the code to its original 
location. Note that none of the text 
storage area ($1391 and up] is written 
to during the move, so recovery from 









Listing 


3 


Id eeee 




jRSSEMBLER 


CRLL, 11-15-81 


20 0000 




J By 


DRV ID h 


. JONES 


30 0000 




:REL0CRTE5 


COLE STORED IN ROM TO RRN 


40 0000 










50 8000 




*=$S000 




60 S000 




FRHl 


=$80 


FROM HODRESS, HIGH BVTE 


70 8000 




FRLC 


=#40 


FROM RDORESS, LOU BVTE 


S0 S000 




TOHl 


=#02 


TO RODRESS, HIGH BVTE 


SB 8000 




TOLC 


=$40 


W RDORESS, LOU BVTE 


100 3000 




FREC 


=$F6 


TEMFORRRV FROM RDORESS STORE 


110 8000 




TREC 


=tF8 


TENFORRRV TO RDDRESS STORE 


120 S000 




blk:: 


-=tl2 


NUMBER OF BLOCKS TO MOVE (HEX) 


130 8000 




RSBM=*I300 


RSSEMBLER/EDITOR ENTRV POINT 


140 S000 










150 S000 










160 8000 


R9S0 


LDR 


itFRHI 




170 8002 


85F7 


5TR 


FREG+ 1 




180 S004 


ft940 


LDR 


#rRLO 




190 S006 


85F6 


SIR 


FREG 




200 S00S 


FI902 


LOR 


#TOHI 




210 seofl 


85F9 


STR 


TREO+ 1 




220 S00C 


fl940 


LOR 


#T0LU 




230 800E 


S5F8 


STR 


TREG 




240 S0I0 


H2/2 


LOK 


«BLKS 




250 S0I2 


FI000 


LOV 


#0 




260 80 14 




} 






270 8014 




; 






280 SOI 4 


BIF6 BLOCK LOR 


iFREG). 


V 


290 8016 


9IFS 


STR 


<:treg>. 


V 


300 SO IS 


CS 


INV 






310 8019 


C052 


CFV 


#$52 


CHECK FOR POSSIBLE END OF CODE 


320 S0IB 


F00B 


BEQ 


TEST 


DO REST OF CHECK IF SO 


330 S0IC> 


C.0O0 


CFV 


#0 


IF NOT CHECK FOR END OF BLOCK 


340 S0IF 


D0F3 


BNE 


Block 




350 8021 


E6F7 


INC 


FREG+ 1 


INCREMENT BLOCK POINTERS 


360 8023 


E6F9 


INC 


TREG+I 




370 S025 


CR 


DEX 




DECREMENT BLOCK COUNTER 


3S0 S026 


O0EC 


BNE 


Block 




390 8028 




i 






400 8028 


£00/ TEST CPX 


#/ 


IF X=/ THEN UE'-RE FINISHED 


410 802FI 


O0E8 


Bh-E 


BLOCK 


OTHERI'IISE 


420 8020 




; 






430 S02C 


4C00I3 


JhP 


RSBM 




440 S02F 




f 







RAM 

For ATARI 
48K RAM BOARD FOR THE 400 

with Lifetime Warranty 

• Highest quality available 

• Reduces power consumption 

• Reduces heat 

48K Board (4oo) $150 
32K Board (4oo/8oo) $ 90 
16K Board (soo) $ qq 

FREE SHIPPING ANYWHERE IN U.S.A. 

Intec 

peripherals 
Corp 

906 E. Highland Ave. 
San Bernardino, CA 92404 

^ (714)881-1533 [§H 



VISA 



ATARI, 400, 800 are Trademarks of ATARI, Inc. 



OSI Disk Users 



Double your disk storage capacity 
Without adding disk drives 

Now you can more than double your usable floppy disk 
storage capacity — for a fraction of the cost of additional 
disk drives. Modular Systems'DiskDoubler^" is adouble- 
density adapter that doubles the storage capacity of 
each disk track. The DiskDoubler plugs directly into an 
OSI disk interface board. No changes to hardware or 
software are required. 

The DiskDoubler increases total disk space under OS- 
65U to 550K; under OS-65D to 473K for 8-inch floppies, 
to 163K for mini-floppies. With the DiskDoubler, each 
drive does the work of two. You can have more and 
larger programs, related files, and disk utilities on 
the same disk — for easier operation without constant 
disk changes. 

Your OSI system is an investment in computing power. 
Get the full value from the disk hardware and software 
that you already own. Just write to us, and we'll send you 
the full story on the DiskDoubler, along with the rest 
of our growing family of products for OSI disk systems . 

^"DiskDoubler is a trademark of Modular Systems. 

Post Office Box 16 C 
Oradell, NJ 07649.0016 
Telephone 201 262.0093 



Modular S.vstems 



No. 57 - February 1983 



MICRO 



25 



moderate crashes can be made by call- 
ing the move routine again and reset- 
ting the 'next available storage location 
pointer' to the end of the text file -i- 1. 
This pointer is stored in location 
$12FE,12FF and is set to $1391 upon in- 
itialization. Cold entry to the 
Assembler/ Editor is from $8000 and 
the 'INIZ' prompt is displayed instan- 
taneously. Warm entry is from $1300 
and you should answer 'no' to 'INIZ', 
as before. 

Putting only these two utilities in 
PROM is worth the cost and effort, but 
there is more. PROM space from $9191 
to $9800 is available for custom rou- 
tines. I have my printer interface driver 
here, a new keyboard service routine, 
Autobasic, a smart terminal routine, an 
EPROM programmer, and still have 
space left over for future expansion. 

There's another advantage! By mak- 
ing BASIC-in-ROM BASIC-in-PROM, 
you can fix the garbage collect bug that 
exists in Microsoft BASIC Version 1, 
Rev. 3.2. I have implemented the code 
recommended by E. Morris in the June 
'81 issue of PEEK(65) and am pleased 
with the results. In fact, the word pro- 
cessor I used to write this article is 
written in BASIC and uses extensive 
string manipulation. 

The diagrams and schematics ac- 
companying this article show you how 
to make the necessary modifications. 
Most of the cuts to the PC traces are on 
the top of the board and are marked 
with a.-ff—. Figures 3 and 4 show the 
best places to make the cuts. 

The jumpers (not shown in figure 3) 
should be apparent in figure 2. 1 marked 
the source of each added or changed 
signal and abbreviated the schematic 
for clarity. You should compare it with 
the original before you attempt the 



A12- 
A13- 



A15. 
A14- 



R/W- 



2- 



Flgure 1: Chip Select Decoding 



23 



22 



19 



21 




AO 

A1 

A2 

A3 

A4 

A5 

A6 

A7 

A8 

A9 

A10 

A11- 



D7 
D6 
D5 
D4 
D3 
D2 
D1 
DO 



2732 



CE OE 



$4000 



74LS04 




74LS02 




A11- 
A12- 

A15- 
A14- 
A13- 



15 
-C|G 



13 



G 
A 
B 
74LS139' 



20 



■ $5000 
— $6000 

$7000 

TT/W 



AO 
A1 
A2 
A3 
A4 
A5 
A6 
A7 
A8 
A9 
A10 



WR _ _ 
OE CS 



2016 
OR 

6116 



D7 
D6 
D5 
D4 
D3 
D2 
D1 
DO 



20 



$2000 



-$2800 

$3000 

$3800 



Figure 2 



FROM U23-2 A14> 
FROM U22-3 A15> 



FROM U15-5 R/W) 
FROM U23-1 A13). 




26 



MICRO 



No. 57 - February 198; 



Figure 3: Top View of PC Board 



U27 




Figure 4: Bottom View of PC Board 





n n 
n n D D 



modification. Basically, all that is 
necessary for the conversion is to 
remove 02 from pin 21 and replace it 
with All, wire in new output enables 
to pin 20, and add the new chip selects 
on pin 18. 

The 2316's use high logic levels for 
CS and therefore require the four sec- 
tions of inverter U16. The 2732's use 
low logic levels for CS or CE, so the in- 
verters are not used. 

You should have confidence in your 
ability to make hardware modifications 
before attempting these changes. The 
entire project can be done in one eve- 
ning and will provide you with in- 
creased performance from your Super- 
board U/CIP at moderate cost. 

David Jones is a technical specialist for 
Racal Milgo Inc., a Miami-based 
manufacturer of data communications 
products. He has a Superboaid II and has 
redesigned the video circuitry for a true 
32/64-chaiacter per line display, built a 
parallel printer interface, adapted an 
EPROM programmer via a 6522 VIA, and 
customized the monitor program in 
addition to the expansion outlined in this 
article. You may contact Mr. Jones at 8902 
S.W. 17 Terrace, Miami, FL 33165. 

JMCftO 

irOHIOSGIEimFIC"\ 



NEW PROGRAMS! 

SCOUT- Full color, machine 
language, fast action and 
graphics! After a year of 
development, comes the all 
machine language SCOUT. 
Patrol the planet surface pro- 
tecting and saving the human 
population from abductors. 
Turn your OSI into a real ar- 
cade! 
$24.95 C4PMF, C8PDF. 

Send for our FREE catalog. 
We have what you want for 
less: S-FORTH $39, FULL 
SCREEN EDITOR $19, 
ADVENTURE $19, SKYHAWK 
$8, TOUCH TYPING $19, IN- 
TELLIGENT TERMINAL $24, 
THE WIZARD'S CITY $12, 
UTILITIES, and much more for 
theCIPtotheCSPDF. 



(312) 259-3150 
AURORA SOFTWARE 

37 S. t^itchell 

Arlington Heights, 

Illinois 60005 





No. 57 - February 1983 



MICRO 



27 



Indirect Files Under OS-65D 



by Richard L Tretheway 



Several uses for the Indirect 
files are discussed, Including 
merging programs, a warm start, 
and transferring programs from 
one OSI operating system to 
another. 



Demo Programs 

requires: 

OSI with OS-65D V.3.3 

The indirect file is one of the most 
powerful and yet underused features of 
Ohio Scientific's OS-65D operating 
system. This file is a buffer in memory 
that can be used for temporary storage 
of either BASIC or assembly-language 
programs. 

You would use an indirect file, for 
example, when you are in the midst of 
writing a program and suddenly realize 
that you either haven't created a disk 
file for the program at all, or the created 
file is no longer large enough to hold 
the cvurent version. At that point, you 
could either store the program in your 
scratch file (that nobody seems to 
remember to have ready for such pur- 
poses), or you could use the indirect 
file. To send your program to the in- 
direct file just enter the command 
"LIST < SHIFT > 'K' ". You will see 
the program listed normally, but it is 
also being stored in the indirect file buf- 
fer. When BASIC returns the "OK" 
prompt you enter a < SHIFT > 'M', 
which marks the end of the file in 
memory. Your program workspace is 
now free to run the directory program, 
or "CREATE" or "DELETE" as needed. 
When you have created the proper file, 
enter "NEW" to clear the workspace 
and type a <CTRL> 'X'. Your pro- 
gram will be reloaded into the 
workspace intact. Don't be concerned 
when you enter the < SHIFT > 'M' and 



BASIC returns a syntax error. The 
operating system knows what you 
want done. 

Those of you familiar with indirect 
files probably noticed that I made no 
mention of the POKEs to 9554 and 
9368, which set the starting addresses 
for input and output for the indirect 
file. OS-65D was developed on and for 
systems with 48K of memory and thus 
these addresses are set by default to 
$8000 hex. If you don't happen to have 
48K, you will have to reset these ad- 
dresses with the appropriate POKEs. 
One good way to decide what number 
to use is to figure out how many pages 



of workspace memory you have, divide 
it by two, and then subtact that num- 
ber from the page number of the end of 
your contiguous memory. For example, 
on a 24K system running OS-65D V3.2 
you have roughly 12K of free RAM, 
which translates to 48 pages of 
memory. Dividing that by 2 yields 24. 
The top of 24K is page 96. 96 - 24 = 72 
and thus, 72 is what I recommend you 
POKE 9554 and 9368 with in your 
BEXEC» so that it is always set up and 
available when needed. 

If you own an OSI disk system 
manufactured before August of 1980, 
you have probably cursed OSI's fast 



Listing 1 



10 REM- Program to add DATA statements to existing programs 

20 REM- to set up L)SR(X) -functions. 

30 S=INT( ( PEEK (8960) -59) /2) +59: POKE 1 33, S-1 

40 SS=PEEK(B960) :REM- System Memory Size in Pages. 

50 PRINT I (28) "To begin, I need to know the starting and ending" 

60 PRINT"memory address where your machine code is in memory .": PRINT 

70 PRINT"For the starting address, " s G0SUB490! SA=A 

80 PRINT"For the ending address, ": G0SUB490:EA=A 

90 PRINT! INPUT"Was this code assembled with an o-f-fset"!Y« 

100 IFLEFT«(Y*, 1 ) <>"Y"THENPR INT; QF=0! GOTO 120 

110 PRINT:PRINT"For the o-f f set , " ! GQSUB490! QF=A 

120 NL=INT( (EA-SA) /15)+1:REM- # lines = size/15 + 1 

130 SP=NL»52!REM- Space = ApproK . 52 bytes » Number o-f lines. 

140 IF EA+SP < SS»256 THEN A= ( INT <EA/256) +1 ) «256! G0T0250 

150 IF S»256+SP < SA THEN A=S*256 : G0T0250 

160 IF (EA-SA)+SP < <SS»2S6) THEN200SREM- Will it ever -fit ? 

170 PRINT! (2S) "This code needs to be reassembled higher in" 

180 PRINT"memory in order for it to -fit in your available" 

190 PRINT"RAM along with the generated indirect •file."!END 

200 PRINT"This machine code routine is simply too large to -fit in" 

210 PRINT"memory along with the generated indirect -file." 

220 PRINT"You might try breaking it up into pieces and then" 

230 PRINT"re-run this program on each individual piece merging" 

240 PRINT"the results into a large program on disk." 

250 PQKE9554, A/256: P0KE9368, A/256! REM- Set up indirect -file. 

260 DA=A:SA=SA-OF!EA=EA-OF 

270 PRINT"What line number should the DATA reading" 

280 INPUT"start with "sLN: PRINT 

290 INPUT"How much should I increment each line number ";I 

300 POKEDA, 13:P0KEDA+1 , 10:DA=DA+2:REM- Initial <CR><LF> 

310 0«=STR«(LN) ! G0SUB600: POKEDA, 32 : DA=DA+1 

320 0«="FORX=" ! GGSUB600! Q«=STR«(SA) : GGSUB620: 0«="TO" 

330 G0SUB600: 0*=STR«(EA) : G0SUB620! POKEDA, 58 : DA=DA+1 

340 0*= "READY!POKEX,Y:NEXTX!RETURN" : G0SUB600 

350 POKEDA, 13 : POKEDA+1,10 : DA=DA+2 : A=SA+OF 

360 LN=LN+I ! 0«=STR«<LN) : GOSUB600: DC=0 

370 0«=" DATA" ! G0SUB600 

380 0«=STR«(PEEK(A) ) s G0SUB620 

390 PRINT".";: IF P0S(0)=63 THEN PRINT! (12) 

(Continued) 



28 



MICRO 



No. 57 ■ February 1983 



< BREAK > key more than once. One 
of the foibles of OS-65D is that there is 
just no good way for you to do a warm 
start after the system has been reset by 
a < BREAK >. But fortunately, OSI 
didn't really desert you after all. The 
indirect file can save all of your hard 
work. Try booting your system and 
enter BASIC with your "BEXEC»" pro- 
gram still loaded in the workspace. 
Now press the < BREAK > key. At the 
"H/D/M" prompt, type "M" to enter 
the machine code monitor, and then 
press "G" for GO. You should now be 
back in BASIC, albeit a crippled BASIC. 
As previously described, enter "LIST 
<SHIFT> 'K' ", followed by a 
<SHIFT> 'M' at the "OK" prompt. 
Now re-boot the system. Clear the 
workspace with the "NEW" com- 
mand. This time at the "OK" prompt 
type a < CTRL > 'X' . Your program has 
been re-loaded, intact, into the 
workspace all ready to be run and/or 
saved to disk. While I'm sure that this 
is a patch that was added after BASIC 
had been written for OSI systems, it 
works and has saved me more hours 
than I'd care to admit. 

You can also use indirect files to 
transfer programs from one operating 
system to another. One of the ways 
that OSI protects users from acciden- 
tally trying to run incompatible soft- 
ware from one operating system to 
another is to use different disk formats 
so that one DOS won't read files from 
another. If you own a color video 
system try booting up your "DEALER 
DEMO" disk, press "P" for "PASS" to 
enter BASIC. Now insert a regular OS- 
65D disk in the drive and try to load the 
"BEXEC»" from that disk. No soap, 
right? Here again, indirect files can 
help. All versions of OS-65D support 
indirect files as does OS-65U. So, to 
transfer programs from one OS to 
another, load your program and send it 
to the indirect file. Re-boot on the 
destination disk. Type "NEW" to clear 
the workspace and type a <CTRL> 
'X', and you're all set to go. 

Indirect files can merge programs. 
Assembly-language programmers are 
notorious for having little pet subrou- 
tines that they use in many different 
programs. If you are careful to use line 
numbers that are dedicated to special 
functions, you can use indirect files to 
avoid having to retype those subrou- 
tines every time you need them. 

To illustrate a use for indirect files 
while in the Assembler/Editor, try 



Listing 1 (Continued) 



400 IF A=EA+OF THEN 450: REM- Done ? 

410 IF A>SS»256 THEN 160 : REM- Out o-f RAM ? 

420 A=A+1 : DC=DC+1 ! REM- INC Address Si Data Counter 

430 IF DC<15 THEN POKEDA, ASC ( " , " ) : DA=DA+1 : G0T0.380 

440 POKED A, 13 : POKEDA+1,10 : DA=DA+2 : G0T0360 

450 POKEDA, llsPOKEDA+l, 10: POKEDA+2, 93: POKEDA+3, 13:P0KEDA+4, 10 

460 PRINTI (28) "The subroutine -for your USR(X) routine now resides" 

470 PRINT"in the indirect -file. To add it to your program, load" 

480 PRINT"your program into the workspace and type a <CTRL> ' X ' . " : NEW 

490 PRINT"Enter the decimal address or hex address preceeded by a '*■" 

500 INPUT" ";A» : PRINT : L=LEN(A*) : IF LEFT* ( A*, 1 ) ="*"THEN530 

510 F0RX=1T0LEN(A*) : C»=MID» (A», X , 1) : IFC*< "0"ORC»>"9"THEN490 

520 NEXTX;A=INT(VAL(A») ) sRETURN 

530 A=0: IFLEN(A*)<2THEN490 

540 FORX=2T0LEN<A») : C*=MID» < A», X , 1) : IFC»< "0"THEN490 

550 IFC»<="9"THENA=A+VAL(C»)«(16'(L-X) ) ! 60T0580 

560 IFC»<"A"0RC*.>"F"THEN490 

570 A=A+(ASC(C»)-55)«(16'-(L-X)) 

580 NEXTX 

590 RETURN 

600 F0RX=1T0LEN(0») ; POKEDA, ABC (MID* (0», X , 1) ) 

610 DA=DA+l! NEXT: RETURN 

620 0*=R I GHT* ( 0* , LEN ( 0* ) - 1 ) : 60T0600 



loading an assembly-language program. 
Now type "P < SHIFT > 'K' ". As with 
BASIC, you will see your program 
listed on the screen. Type a < SHIFT > 
'M' to close the file. Now type "I" and 
respond with a "Y" to the prompt 
"INIZ?". Confirm that the workspace 
is clear by typing "P" again. Now try 
our usual < CTRL > 'X' . Your program 
will be reloaded. The operating system 
stores your program in discreet ASCII 
when you use the indirect file. When 
you download a program from the in- 
direct file, the OS interprets the incom- 
ing lines just as if you had typed them 
in from the keyboard. Should you have 
a program in the workspace while you 
are downloading a program, duplicate 
line numbers will be replaced by the new 
lines just as if you had typed in a correc- 
tion to a line with a syntax error in it. 

But a crafty assembly programmer 
could arrange a library of disk files con- 
taining his most used subroutines, be- 
ing careful to avoid duplicate line 
numbers. Whenever one of those pro- 
gams is needed, he would just send the 
destination program that was resident 
in the workspace to the indirect file, 
then load the subroutine file and merge 
the two by typing a <CTRL> 'X'. It's 
not perfect, but at least it can save a lot 
of typing. 

To illustrate another use of indirect 
files, I have written a short program. 
This program takes a machine-code 
program (resident in memory) and con- 
verts it into a subroutine written in 
BASIC that does the appropriate POKEs 
to set up a USR(X) function. It could be 
used to transfer a machine-code pro- 
gram from your disk system to a 



friend's system that just has a cassette. 
He still won't be able to read your disk, 
but at least he would have a copy of 
your program in a form he can use. 

To use the program, save it on disk 
and then assemble your machine-code 
program in memory. Since the memory 
maps of disk and cassette systems are 
very different, my program takes any 
offsets that you had to use into account 
when creating the new subroutine. 
When the machine code is in place, re- 
enter BASIC and run my program. It 
will ask you where the machine code is 
in memory [and will accept the hex ad- 
dress if you didn't figure it ahead of 
time), what line numbers to use for the 
subroutine to be created, and finally, 
offsets, if any. After the program has 
run just type a <CTRL> 'X', since my 
program has already NEWed itself out 
of existence. You can now save this 
program on disk, or run it and it will 
faithfully recreate your machine-code 
program. Note that my program was 
written using OS-65D V3.3 and has 
some print statements that do cursor 
addressing under that OS. Those of you 
still running 65D V3.2 can eliminate 
the parts of the print statements that do 
this (i.e., "!(12|" inline 280 should be 
eliminated) . 



You may contact the author at 5405 
Cumberland Rd., Minneapolis, MN 55410. 



iiMCRO 



No. 57 ■ February 1983 



MICRO 



29 



LjjN 


\]\ 


imm 


ix/Xi 


SI 


fij^tjUT 


903 


[n] 


SOFTWARE FOR CBM 64 E 

Word Processino 




Qcommodore 



INTERFACES 

ADA-1 450 Serial S149 

ADA-1600 Parallel 149 

RS232 caDle for Vic or 64, 2m 30 

Video/Audio cable for 64 & monitor _ 25 

MONrrORS — Great resolution 
for the CBM 64 or VIC 

Panasonic, 13" Color S375 

Amdek Color I 330 

NEC JB 1201M, 12" Color 330 

NEC JB 1201. 12" green phospfior 170 

Amdek Video 300L, green phospfior 175 

BUSINESS SOFTWARE 

Spellmaster Dictionary (great for WordPro') S199 

OZZ Data Base System (8050) 240 

Silicon Office (database, wp) 995 ( 

Wordcraft 80 289 

VisiCalc (new expanded) 199 

Dow Jones Portfolio Management System (RS232) 120 

WordPro 4+ or 5 ^ . 299 

Tfie (l/lanager 199 

Legal Time Accounting 425 

I.R.M./L_ ' 295 

BPI A,'R, G/L, Job Cost, Inventory, Payroll 325|; 

SJB will-service any VIC or CBM64. 

MasterCard, Visa, Money Order, Bank Check 

COD (add S5) accepted. 

Add 3% surcharge for credit cards. 

In stock items shipped within 48 hours, FO.B , Dallas, TX 

All products shipped with manufacturer's warranty 

TO ORDER CALL TOLL FREE 
800-527-4893 800-442-1048 with n Texas) 

SJB will meet any competitive price under ^ 
similar in-stock conditions. ylllK 

SJB DISTRIBUTORS, INC./^ 

10520 Piano Road, Suite 206 ■ 
Dallas, Texas 75238 
(214) 343-1328 

Prices are subject to change without notice. ^^. ,„ ,„ 



Business Hours 
M-F 8 to 6 
Sat 10 to 2 



$90 

Computer Tutoring Game (COCO) 50 

General Ledger 199 

Pet Emulator (emulates 4.0 basic) 30 

CBM EasyCalc (for the 64) 99 

CBM EasyFinance 50 

CBM EasyPlot 80 

CBM EasyScan (appointment manager) 80 

Sprite-Magic (build sprites on screen with 

Joystick, save to disk or cassette) 30 

Assembler Package for CBM 64 (cassette) 
Editor (creates and updates source code), 

Assembler, Loader, Disassembler 50 

Mail Mate 50 

IEEE Interface (64) 100 

Parallel Interface 90 

RS232 Interface (modems, printers) 45 

VIC PRODUCTS 

VIC 20 Computer, 5K $199 

Vic Datasette Recorder 60 

Vic 1541 Disk Drive 395 

VIC MODEM (for CBM 64) 100 

VIC 1525 Graphic Printer (for CBM 64) 325 

8K Memory Expansion Cartridge 49 

16K RAM 99 

24KRAM 155 

IEEE Interface (VIC) 85 

Gorf (great arcade game) 30 

Omega Race 30 

Midnight Drive 23 

VIC 3 slot Expander 43 

VIC 6 slot Expander 83 

Seawolf 23 

Cosmic Cruncher 23 



Arcade Joysticks — Heavy duty with 2 firing 
buttons! Great for the VIC or 64 

SuperPET (5 languages, 2 processors) 

CBM 8032 Computer 80 column 

CBM Memory Expansion, 64K 

PET 4032, 40 Column 

CBM 8050. 1 Mg Dual Drive 

CBM D9060, 5 Mg Hard Disk 

CBM D9090. 7 5 Mg, Hard Disk 

CBM 4040. 340K Dual Drive 

CBM 2031, 170K Single Drive 

PRINTERS — LETTER QUALITY 

CBM 8300,40cps 

Diablo 620,25cps 

Nee Spinwriter 7700,55cps 

Nee Spinwriter 3500,35cps 

PRINTERS — DOT MATRIX 

CBM 4022,8Qcps;graphics 

CBM 8023,150 cps.graphics 

Okidata 82A,120cps,'serial or par 

Nee 8023A(parallel) 



30 



MICRO 



No. 57 - February 1£ 



/AlCftO 

From Here To Atari 



By Paul S. Swanson 



Languages 

The language C, offered in interpreter 
and compiler versions, was recently 
added to the list of languages available 
to Atari 400 and 800 systems. FORTH, 
PILOT, and several other high-level 
languages have been available for some 
time. But despite the large number of 
choices for languages, the most popular 
seem to be BASIC and assemblers. 

There are several versions of BASIC 
and several assemblers. Of the 
assemblers, the original cartridge ver- 
sion from Atari can be implemented on 
even a 16K system, which is an 
advantage for those who have not ex- 
panded their systems to 48K. Atari also 
provides a macro assembler. I chose the 
Synassembler (Synapse Software), 
which assembles faster than the Atari 
cartridge and is less expensive. 

Almost every Atari computer is pur- 
chased with a version of BASIC — 
usually the cartridge BASIC. There is 
also a form of Microsoft BASIC for 
those of you who want to, on your 
Atari, run software that was written for 
other computers. Because of the note 
and point style of random access used 
on the Atari, there is a big difference in 
the disk commands between the Atari 
version and the versions on the Apple, 
Radio Shack, and IBM computers. 

Monarch Data Systems (P.O. Box 
207, Cochituate, MA 01778) offers a 
BASIC compiler. Compiled programs 
can run 4 to 12 times faster than the 
interpretive code. Several restrictions 
limit the use of this compiler, but these 
are easily circumvented for most ap- 
plications. For example, the compiler 
uses fixed point arithmetic instead of 
the slower floating point, so there are 
no trigonometric functions. There is 
also no RND( function supported, so 
you must use a PEEK[53770) and ex- 
tract a random number by multiplying 
that result (a random number between 
and 255), then dividing to get a 
number in the proper range. The LOAD 



and RUN statements are also not sup- 
ported, so the program caimot chain to 
other programs. For more information 
on this compiler, contact Jeff Goldberg 
at Monarch Data Systems. 

Hardware 

Many letters from readers express 
an interest in the hardware and ask 
questions about the keyboard I was 
marketing. I recalled the keyboard 
because several manufacturers produce 
keyboards just like it, and they can pro- 
duce them more cheaply than I can. 
However, I am vmting an article 
describing how I built my keyboard 
(you can build one for under $20 plus a 
weekend of time instead of buying one 
for over $100). 

Several questions have been asked 
about the controller jacks at the front of 
the Atari console. These jacks provide 
the simplest interfaces to any external 
device. They are connected to eight 
A/D (analog to digital] converters and a 
PIA (peripheral interface adapter). See 
the last page of your Atari hardware 
manual for a diagram of the pins and 
jacks. Port A controls the joystick pins 
of jacks 1 and 2 and Port B controls 
those on jacks 3 and 4. As you look at 
the computer from the front, the MSB 
is on your right and the LSB is on your 
left. To use them for input, you do not 
need special codes — just PEEK(54016J 
for Port A or PEEK(54017] for Port B. 

To set up pins for output, you must 
write to the direction control register. 
An example of setting up Port B as an 
8-pin output follows: (to use Port A in- 
stead, subtract one from the PEEK and 
POKE addresses) 

100 POKE 54019,56 
110 POKE 54017,255 
120 POKE 54019,60 

POKEing 54019 with a 56 tells the 
computer to take the next POKE to 
54017 as a direction control code. This 
is a binary code with each bit corre- 
sponding to a pin on the jacks. If the 
corresponding bit is 1, the pin is de- 
fined as output and if it is a zero, the 
pin is set up as input. 



Once you have completed that sec- 
tion of code, you may then POKE to 
54017 whatever you want to send out. 
If you POKE there and then PEEK the 
same location, you will get back the 
code you sent, as if it were a RAM loca- 
tion. Therefore, if you set the low-order 
four bits as output and the upper four as 
input, you can send a code out then 
read the input combined with the code 
you sent. This makes scanning con- 
trollers simple to set up in the soft- 
ware. The value you read is what you 
sent plus 16 times the value that your 
device sends back. 

The plugs for those jacks are not 
easy to obtain. You can get plugs that 
work from APX, but they cost almost 
$7 each (plus postage) and you must 
have a minimum order. Just check 
around in your area for a suitable store. 
My source is Eli Computers in Cam- 
bridge, MA. 

A ground and +5 volts are 
available, also. For larger projects it is 
best to have an independent power sup- 
ply for your device. According to Atari, 
you can draw as much as 300 mA from 
these pins (total — not per port), which 
should be enough to drive many 
smaller devices. 

Thanks to Devin MacAndrew for 
calling my attention to an error in my 
November column. The 64K board I 
mentioned, according to the advertise- 
ment he sent me, is available from 
Mosaic ( Mosaic Electronic Inc., P.O. 
Box 748, Oregon City, OR, 97045] 
and bank selects only above the 48K 
boundary, using a 4K address space not 
used by the hardware registers or 
operating system. 

Future Columns 

As many columns as possible will 
be based on mail I receive, so by all 
means, keep writing. Please mention 
specific applications and include a 
description of your hardware configura- 
tion. The next few columns will deal 
with various aspects of the hardware 
available on standard Atari computers. 



JMCftO 



No. 57 - February 1983 



MICRO 



31 



In The Beginning 
Was The 
Word. . . 






,vHK 



C<^^ 



Q^' 



Lttt^ 



V\J' 



*\^*^ 



^To** 



MICROCOCCUS'MICROLITER 



micrococcus, mi kro kok' us, n. a microscopic organisr 
of a round form. 

Microcomputing, mi' kro kom put ing, n. (Gr. mikro; 
small, and L. computo, to calculate.) The multi-syster 
monthly journal for computer enthusiasts, containin 
all the information needed to turn your microcomputc 
into a powerful machine. Includes dozens of new pre 
grams, articles on innovative computer application; 
buyer's guides, new programming techniques, accuraf 
reviews of hardware and software, complete coverage ( 
new products, tips on your system's hidden capabilitie; 
hardware modifications, tutorials, utilities, boo 
reviews, industry news. Plus features on computers i 
business, science, education and games. Written i 
understandable language by experts in the field of con 
puting. Special emphasis is placed on the Apple* Atar 
Commodore, Heath and IBM systems, but not to the e; 
elusion of other systems. 

(Ed. note — A one year subscription to MICROCOA' 
PUTING is only $24.97. Call 

1-800-258-5473 

Or send in the coupon below.) 

microcopy, mi' kro kop i, n. A photographic copy c 

printed material or photographs . . . 

MICROCOMPUTING 

The First Word in Computer Publishii 

'Apple® is a registered trademark of Apple Computer, Inc. 



YESl I want to get the First Word in Computer Publishing. Send me 12 issues of MICROCOMPUTING for 

$24.97. □ Check enclosed □ MC □ VISA DAE D Bill me 

731 RMC 
Card# Exp. Date 

Interbank^ 

Name 



Address . 
City 



_^State_ 



_Zip_ 



L 



MICROCOMPUTING' 



Box 997 
Farmingdale, NY 11737 



Canada & Mexico $27.97, 1 Year OnJy, U.S. Funds 

Foreign Surface $44.97, 1 Year Only, U.S. Funds Drawn on I 

Allow 6-8 weeks for delivery. 



32 



MICRO 



No. 57 - Februar 



It's All Relative - Using CBM's 
Relative Records, Part 3 



byJimStrasma 



J: 



This third instailment describes 
the use of a key file as an index 
into a relative file. The author 
draws examples from the update 
module of a powerful mail-list 
package (available from the 
author and various user groups). 

Last month we learned how to create 
relative files, using the "Create" 
module of Chris Bennett's "Mail List 
4040." This time we will set up a key 
file as a framework for accessing 
relative files. Our example is the "Up- 
date" module of Chiis Bennett's mail 
list. As before, you may want it handy 
as you read. 

Cautions 

Bennett's "Update" module, loaded 
from "4040 menu," is the largest 
module in the package. Be careful 
about changing it. If you lengthen it 
more than a couple of lines, you will 
need to increase the value POKEd into 
location 43 (or your BASIC'S equiva- 
lent) in line 1060 of the "Setup" 
module, as explained in part one of this 
series (55:37). If you want to save space 
for more names, shorten this module 
and change the above line to match. 

As supplied, there is only enough 
main memory free to maintain about 
1200 names, even in disk drives far 
larger than the 4040. This is also about 
the size limit for a relative file on the 
8050 disk drive; [i.e., six-side sectors 
referencing 120 sectors, containing 254 
bytes of data each). The 8050 file size 
limitation does not apply to other 
Commodore disk drives. 

Using a Key File 

A relative file permits simple access 
to any record within a file, as long as 
we know its position within the file 
relative to other records. However, that 
is rarely the case. We are more likely to 
know the name we want than the 



record number. To deal with this, most 
file-handling programs use one or more 
additional files as indexes to the main 
file. These files usually contain a value 
for each record in the main file. The 
values are ordered in some way, usually 
reflecting the alphabetic ordering of 
some field within the records of the 
main file. Fields used this way are called 
key fields, because they act as keys to 
gain access to the file. In Bennett's 
mail list, the key field is a combination 
of two fields — the first ten characters 
of the last name, followed by two char- 
acters of the first name. 

In smaller programs, the key file 
may actually contain the contents of 
the key field, along with the number of 
its record in the main file. This method 
provides the fastest access, but uses 
memory quickly. Therefore, large pro- 
grams usually store the key value on 
the disk, accessing it there when needed. 
Either way, the key file is kept sorted at 
all times by the contents of the key 
field. This allows records to be located 
with a binary search (see Alfred Bruey's 
article on page 37 for more on binary 
searches), a technique offering very 
quick access to information already 
sorted. Here is the binary search used 
in the mail list: 

4460 FS = 

4580 I = 1 

4590 J = NV 

4600 IF I > J THEN 4700 

4610 K = INT((l-l-J-l-1)/2) 

4620 l%=K%(K) 

4630 GOSUB 5320:REM READ KEY 

4640 IF K$ = KY$ THEN 4680 

4650 IF K$ < KY$ THEN J = K - 1 : 

GOTO 4600 
4660 K =: K -I- 1 
4670 GOTO 4600 
4680 RR = K%(K) 
4690 FS = 1 
4700 RETURN 



Variable FS starts equal to zero and 
is changed to -i- 1 if key value K$ exists 
in the key field. Notice that array K%( | 
contains only the numbers of records in 
the main file. Subroutine 5320 returns 
the key field from the main file in 
variable KY$: 

5310 REM READ THE KEY IN RELATIVE 

RECORD NUMBER 1% 
5320RECORD#1,(I%) 
5330 IF DS THEN 1690 
5340INPUT#1,KY$ 
5350 IF DSTHEN 1690 
5360 RETURN 

If you don't have BASIC 4, you will 
need to substitute for the RECORD# 
statement above (as described in part 
two of this series (56:52). 

By making the key field the first one 
in each record, it can be read with a 
single INPUT# statement. Note that 
the only difference in BASIC 4 between 
reading a field from a relative file and 
reading it from a sequential one is the 
RECORD# statement preceding the read. 

Keeping Keys Sorted 

Next, let's consider the way keys 
are kept sorted. At any moment there is 
no more than one key value out of order 
— the one currently being added. When 
a record is to be added to the file, its 
key field is first checked, using the 
binary search above, to see if it is a 
duplicate of one already in the file. This 
is not allowed in the mail list, though 
some programs do permit duplicate 
keys. Next, another subroutine makes 
room for the new key in the K% ( ) array 
that will become the updated index file 
at the end of the program run: 

2360 REM DO BINARY INSERT 

ON KEY K$ 
2370 IFP <1 THEN P=1 
2380 IF NV = 1 THEN K%(1)=1:G0T0 

2490:REM EXIT 



No. 57 - February 1983 



MICRO 



33 



2390 EZ = P + 2:IF EZ > NV - 1 THEN 

EZ = NV-1 
2400 FOR K = P TO EZ 
2410 : l% = K%(K) 
2420 : GOSUB 5320:REM READ KEY 
2430 ; IF K$ < KY$ THEN P = K:K = EZ 
2440 NEXT 
2450 IF K$ > = KY$ THEN K%(NV) = 

RR:GOTO 2490:REM EXIT 
2460 E = NV 

2470 SYS DL,0,P,E,K%(0),ZZ 
2480 K%(P) = RR 
2490 RETURN 

Lines 2370-2390 and 2450 handle the 
top and bottom limiting values. The 
other lines perform a binary insert to 
find quickly the place where the new 
key field should go in the file. Once 
located, the SYS call in line 2470 opens 
a space for it in the K%( J array. Until 
we cover these calls at the end of this 
series, readers without BASIC 4 may 
use a BASIC substitute: 

2470 FOR GO = E TO P + 1 STEP - 1 
2473: K%(QQ)=K%(QQ-1) 
2476 NEXT 

Where QQ is simply an otherwise 
unused variable. Once a hole is opened, 
it is filled with the value of the current 
record number RR. 

When a record is deleted, the pro- 
cess is similar. First, its key and record 
number are found using the binary 
search above. Then, after double- 
checking that the user really wants to 
delete that record, its place in the key 
array is removed, with each value 
above it moving down one: 

3250 IF P<> NVTHEN SYS 

DL,1,P,E,K%(0),ZZ 
3260 K%(NV) = 

Or, in BASIC: 

3250 IF P = NVTHEN 3260 
3252 FOR 00 = P TO E - 1 
3254 : K%(00) = K%(00+ 1) 
3256 NEXT 
3260 K%(NV) = 

This process frees a space in the 
relative file for re-use. To handle this, 
Bennett's mail list remembers the de- 
leted record number, RR, in a separate 
array DE%| ], indexed by ND, the 
number of currently deleted records. 

3270 ND = ND-H1 
3280 DE%(ND) = RR 



When new records are added later, 
these spots are re-used first, as we will 
see next time. As supplied, Bennett's 
mail list dimensions DE%( ) to NR, the 
maximum number of records. If you 
were suddenly to delete every one of 
the list's 1000 name capacity, the array 
would hold it. On the other hand, if you 
want to have over a thousand records, 
you may need to reduce the capacity of 
this array. Unless your list is highly 
volatile, a dimensioned size of NR/10 
should be adequate. Array sizes are de- 
fined in line 2070 of the set-up module. 

Reading the Key File 

To be useful, key file information 
has to be in memory during the pro- 
gram run and on diskette, preserved for 
future use. Further, when its informa- 
tion is changed, the disk copy needs to 
be replaced. Naturally, we want to do 
all this as quickly, compactly, and 
safely as possible. 

The first aid to speed is that the key 
file is read only once per session; if the 
currently needed key is already in 
memory from earlier use of this or 
another module, it is not read again. 
Variable GD (got data) keeps track of 
this for us: 

1160 IFGD< >1 THEN GOSUB 

4720:GD = 1: REM READ IN KEY 
FILE IF HAVEN'T 

Since we will always want to read the 
entire key file at once, and in order, it is 
kept in a sequential disk file. When it is 
to be read, this routine does the work: 

4710 REM READ IN KEY FILE 
4720 D0PEN#9,D(DD),"INDEX" ON 

U(UN) 
4730 IF DSTHEN 1690 
4740 INPUT#9,F$,NR,NV,ND 
4750 IF DSTHEN 1690 
4760 IF NV = OTHEN 4790 
4770 FOR I = 1 TO NV:INPUT 

#9,K%(I):IF DS = OTHEN NEXT: 

GOTO 4790 
4780 GOTO 1690 
4790 IF ND=0THEN 4820 
4800 FOR I = 1 TO ND:INPUT#9, 

DE%(l):IFDS = 0THEN 

NEXT:GOTO 4820 
4810 GOTO 1690 
4820 DOLOSE 9 

In BASIC 2, substitute: 

4720 OPEN#9,UN,9,DD$ + "INDEX, 
SEOUENTIAL.READ" 



4725 GOSUB 60010:REM CHECK DISK 

STATUS 

(also use as line 4745, and within 

lines 4770 and 4800, just before 

IF DS.) 
4820 CLOSE 9 

Line 4720 opens the sequential file 
"index" to read. Then a few special 
values are read in: 
F$, the name of the mail list 
NR, the next record number to be used 
NV, the maximum number of records 

it may contain 
ND, the number of deleted records to 

be replaced before adding new ones 
After this, the key array K%( ] is filled 
in a single line, as is the DE%( ) array 
two lines later. The reason for cram- 
ming these into single lines is to save 
time in reading it. FOR... NEXT loops 
contained entirely on a single line work 
far more quickly than those spanning 
several lines, especially this far along in 
the module. The difference is due to 
not having to scan for line numbers 
within the loop. As written, the pro- 
gram falls through lines 4770 and 4800 
only if there is a DOS error. If it does 
fall through, the session will be 
terminated. 

Writing the Key File 

At the end of each use of the "up- 
date" module, Bennett's mail list 
checks to see if the key file needs to 
be rewritten to disk. If nothing has 
happened to change the file in mem- 
ory, variable UP will equal zero. Any 
other value triggers a rewrite of the 
key file. This flag variable is checked in 
line 1390: 

1390 IF UP THEN GOSUB 5060: 
REM WRITE KEY FILE 

Due to a shortage of space on the 
4040 diskette, "update" does not use 
the best method of replacing the "in- 
dex" file. Ideally, we would first 
rename the existing file as "old", then 
save the updated file under the correct 
name, and finish by scratching "old" 
after the new copy is properly closed. 
Unfortunately, this requires enough 
spare storage on the diskette to hold 
two copies of the "index" file, and we 
don't have that much room to spare 
when the file is full. The same problem 
keeps us from using the "@" SAVE- 
WITH-REPLACEMENT option of CBM 
DOS. It works much the same way, 
making a spare copy of the new version 



34 



MICRO 



No. 57 - February 1983 



before destroying the old one. If you 
have a larger capacity disk drive, either 
of the above methods would work well. 
But on the 4040, we do it this way: 
5050 REM WRITE OUT KEY FILE 
5060 PRINTTAB(11)"WRITING KEY 

FILE" 
5070 SCRATCH "INDEX", D(DD) ON 

U(UN) 
5080 IF DS> 1 THEN 1690 

In BASIC 2, substitute: 

5065 OPEN 15,UN,15 

5070 PRI NT#1 5, "SCRATCH " + DD$ + 

"INDEX" 
5075 GOSUB 60020:REM CHECK DISK 

STATUS WITHOUT REOPENING 

FILE 15 
(Considering how often BASIC 2 users 
will be opening and closing file 15, it 
would probably be better to open it 
once in the setup module, and not close 
it again until the program ends.) 

After eliminating the old copy of the 
file, "update" now proceeds to save a 
new version: 

5110 D0PEN#9,D(DD),"INDEX", 

W ON U(UN) 
5120 IF DS THEN 1690 
5130 PRINT#9,F$C$NR;C$NV;C$ND 
5140 IF NV = 0THEN 5170 
5150 FOR I = 1 TO NV:PRINT#9, 

MID$(STR$(K%(I),2):NEXT 
5170 IFND = OTHEN 5190 
5180 FOR I = 1 TO ND:PRINT#9, 

DE%(I):NEXT 
5190 IF DSTHEN 1690 
5200 DCLOSE 9 
5210 IF DSTHEN 1690 

In BASIC 2, substitute: 



5110 OPEN 9,UN,9,DD$ + "INDEX, 

SEQUENTIAL,WRITE" 
5130 PRINT#9,F$C$NR;C$NV; 

C$ND;C$; 
5150 FOR I = 1 TO NV:PRINT#9, 

MID$(STR$(K%(I),2)C$;:NEXT 
5180 FOR I = 1 TO ND:PRINT#9, 

DE%(I)C$;:NEXT 
5200 CLOSE 9 

Notice the use of C$ (containing the 
carriage return character) as a delimiter 
in line 5130. This is the only safe way 
to write multiple variables in a single 
PRINT* statement. Due to a bug in 
BASIC 2, it is also the only way to 
fmish a PRINT* statement to the disk, 
as shown in the alternate lines above. 
Note too that semicolon spacing be- 
tween variables is the default, and only 
needs to be made explicit when vari- 
able names could be confused. 

The complex expression in line 
5150, MID$(STR$(K%[I),2), saves disk 
storage space at the cost of file rewrite 
speed. When a numeric variable is 
PRINT#ed to the disk, a leading space 
is left for its sign, if any. Since a file 
can't have a negative record number, 
the space is wasted — and would fill 
four disk sectors in Bennett's mail list. 
The expression strips off the sign space 
by turning the number into a string and 
ignoring its first character. If your disk 
has more capacity, improve your re- 
write speed by using a simple PRINT # 
"nstead, as in line 5180. (Since the 
number of deleted records is usually 
small, little would be gained by using a 
complex expression in line 5180.) 

Also note that once the file is suc- 
cessfully opened, the disk status is not 
checked again until an attempt has 



been made to write all the data in the 
file. This saves time, and if there is an 
error anywhere in the process, the final 
check will catch it. DOS errors during 
PRINT # are not fatal to the program if 
ignored. However, don't try this when 
reading the file. Failing to check disk 
status after every INPUT* will likely 
halt the program on any DOS error. 

What About Alternate Keys? 

Careful study of Bennett's mail list 
will reveal an alternate key, in addition 
to the primary one, handled in much 
the same way. We left it out of our dis- 
cussion because it is not fully 
developed. At present, it merely re- 
cords record numbers — a chore easily 
handled without a second key. In an in- 
complete 8050 version of the mail list, 
Bennett went further, using the code 
field as the alternate key field. 

If you need one or more alternate 
keys, just maintain them along with the 
primary one, changing all of them when- 
ever any one is altered. Essentially, ex- 
tra keys are a trade-off. Maintaining 
them increases the time needed to add, 
delete, and change records, and adds to 
the complexity of the program. But 
maintaining these keys eliminates the 
delay of sorting before printing records 
out in ZIP code or other new orders. 

Next month we finally get this 
beast on the road, reading and writing 
relative file data. 



The author may be contacted at 1280 
Richland Av., Lincoln, IL 62656. 



JMCftO 



BEEP! LOST YOUR PROGRAM? 



BUS RIDER 
LOGIC ANALYZER FOR THE APPLE II 

The Bus Rider is a self diagnostic development tool that allows real time 
analysis of software and hardware in the Apple II computer. 

The Bus Rider provides; 

• Monitors and saves 51 2 cycles of the address and data bus, Nfvll, IRQ, 
DfvIA, R/W and 4 external lines. 

• Pretrlgger viewing of up to 51 2 samples. 

• 4 external inputs with variable threshold reference. 

• Display cycle by cycle execution or 6502 disassembled code. 

The Bus Rider comes complete with Bus Rider circuit card, reference manual, 
Bus Rider software diskette, and 10 easy hook external input cable. 

The total system price is $395.00 




Bus Rider- Disassembled Display 

RC Electronics Inc. 

5386 Hollister Avenue, #D 
Santa Barbara, CA 931 1 1 

(805) 968-661 4 • TELEX 295281 



Visa 



No. 57 - February 1983 



fvllCRO 



35 



ABILITY 



Ibc/ Pick The Disk System, MegaFlex Controls It! 



I 



WITH SOFTDRIVERS FOR 
A FLEXIBLE FUTURE! 

MEGAFLEX— a universal 
floppy disk controller and 
modern alternative to the 
Apple drive system offering 
increased storage, im- 
proved reliability and . . . 
FLEXIBILITY. 

Enjoy megabytes of 
online storage with your 
choice of micro, mini, or 
maxi drives— or even 6Mb 
with the Amiyn cartridge 
pack! Ideal for high- 
capacity storage now, 
Winchester-disk backup 
later 

The MEGAFLEX secret is to autoboot soft 




BRIDGE THE APPLE 
FORMAT BARRIER! 

The MEGAFLEX diskette 
does what Apple's 
cannot— read and write 
diskettes from other 
computers! Software- 
controlled industry-stan- 
dard IBM 3740 or System 
34 type formats allow the 
MEGAFLEX library of refor- 
matting software to read 
and write Altos, Radio 
Shack, Osborne, and IBM 
PC diskettes. (Call for the 
latest software details.) 
MORE STORAGE, MORE 
UNIVERSAL FEATURES, LOWEST COST 
MEGAFLEX with 8" maxi or high density 5.25" 



drivers that match the needsof your drive system, minis gives you 1.2 Megabyte of formatted data per 
All hardware functions are software-controlled, diskette for 8 times the file and data size! 



MEGAFLEX can match new drive capabilities with- 
out hardware changes. Drive-dependent ROMs 
have been eliminated. 

APPLE ///? OF COURSE!! 

MEGAFLEX is compatible with BASIC, CP/M, 
Pascal, VISICALC, SOS and DOS-emulation on the 



MEGAFLEX offers flexible software choices: 

• data rate (250/500 Kbits per second), 

• single and double density recording, and 

• single/double sided drive operation (max 
4 drives). 

MEGAFLEX has the lowest chip count of any 



Apple III, Apple II, Franklin Ace and Basis. All Ian- controller today! This means less power, a cooler 

guage features and operating system commands Apple and better reliability. 

(LOAD, BRUM, etc.) are standard. If you can oper- Lowest price, highest performance, that's 

ate Apple drives you can op- ^ a ■H^fll A flK^.ABIHHH^"' '^^^^'^'~^^' 

erate MEGAFLEX! Your ^^ ^ZV^Lj^kll^^^r^^^S 11722 sorrento valley road 

Apple software will run with-jyitVaFW I I fci^ ?ei9,45'^oioi ' 

out modification too. a Division of SVA 



TWX 910-335-2047 APPLE TWO SDG 



THAOEMAHKS CP/M-Oigtial Research 



A Binary Search Routine 



by Alfred J. Bruey 



This article describes the binary 
search technique and then 
presents two demonstration 
programs. One sets up a sorted 
test file that can be searched 
using a binary search; the other 
sets up a sorted test file and 
allows a record to be inserted in 
Its proper place. This binary 
search technique can be used 
as the basis for a complete data 
base system. 

Sort Routines 

require: 

Any Microsoft BASIC 
computer 

Your computer is handy for keeping 
lists of names, right? But how do you 
find a particular name, especially if 
your list is in random order? You could 
write a program to start at the begin- 
ning of the file and compare items one 
by one with the name you want. Of 
course, this process would be extremely 
time-consuming. And if the name you 
were searching for wasn't there, you 
wouldn't know until you had searched 
the entire list! 

Unfortunately, there is no better 
method to search for an item if the list 
is in random order. Therefore, you 
should make sure youi file is in alpha- 
betical order; the rest of this discussion 
will assume your file is in order. 

The binary search routine presented 
here can be used to find items on a 
sorted list. You can also use this 
routine to find where you should place 
a new item. 

The principle of the binary search is 
as follows (note that in any of the steps 
below, you are done if you get an exact 
match) . 

1. Check the first item on the list. If 
the value you're searching for is less 



than this, the item isn't on the list. 

. Go to the middle value on the list. If 
the value there is greater than your 
search value, you've got the search 
narrowed to the first half of the list. 
If not, you've got it narrowed to the 
last half of the list. 

, Next try the middle value of the in- 
terval found in step 2 above. Now 
you have the search narrowed down 
to one quarter of the list. 
The next comparison will narrow 
the search to l/8th of the hst, the 
next to l/16th, etc. Therefore, 
counting your compare with the first 
item on the list, you will have your 
missing value narrowed down to 
l/16th of the list after only five 
compares, l/32nd of the list after six 
compares, l/64th after seven com- 
pares, etc. 



5. Continue this process until you find 
the item, or reduce the list to one 
item. 

Subroutine Description 

The binary search subroutine 
shown as part of figure 1 (lines 10000 
and greater) performs as follows: 

1. The value you are searching for is 
put in NM$. 

2. The file being searched is assumed to 
be in array N$ . 

3. If the value NM$ is found in array 
N$, its location is returned as the 
value of variable J. (The first item in 
array N$ isN$(Oj.) 

4. If NM$ isn't found in array N$, the 
value of J will be the index of the 
next array value larger than NM$. 

Let's look at some examples with a 
file N$ that contains the following 



Listing 1: Routine to Find Records 



10 REM ***********••*••••*••••••• 

20 REM ROUTINE TO FIND RECORDS* 
30 REM •••••••••**••••••••••••*•• 

35 DIM NS(IOOO) :N-10 

4 DATA BILL, CARL, CARL, DON, JOHN , MAR I E, MARY , PETE, ROGER, ROGER, ZZZZZ 

50 FOR 1=0 TO N 

60 READ N$(I) 

7 NEXT I 

80 INPUT "ENTER VALUE YOU WANT TO SEARCH FOR (ENTER XXX TO STOP)";NMS 

90 IF NMS»"XXX" THEN STOP 

100 GOSUB 10000 

110 PRINT "INDEX ";J:" FOUND FOR SEARCH ARGUMENT ";NMS 

120 GOTO 8 

10000 REM ************************* 

10010 REM BINARY SEARCH SUBROUTINE* 

10020 REM ************************* 

10030 J»0 

10040 IF J»=l THEN 10200 

10050 IF N<»0 THEN 10200 

10060 IF NMS<NS(0) THEN 10200 

10070 J1 = 0:J2=-N 

10080 J=-INT( (Jl+J2)/2) 

10090 IF NM$-N$(J) THEN 10140 

10100 IF NM$<N$(J) THEN J2»J:G0T0 10120 

10110 Jl-J 

10120 IF JOINTC (Jl+J2)/2) THEN 10080 

10130 J»J+1:G0T0 10200 

10140 IFJ-0 THEN 10200 

10150 IF J"l AND NM$=-N$(J-1) THEN J-0 : GOTOIO 20 

10160 IF J-1 THEN 10200 

10170 FOR J»J TO 1 STEP -1 

10180 IF NM$<>N$(J) THEN J-J+1:G0T0 10200 

10190 NEXT J 

10200 RETURN 



No. 57 - February 1983 



MICRO 



37 



names (we will be using this file later 
in the sample computer program) : 



ex No. 


Name 





BILL 


1 


CARL 


2 


CARL 


3 


DON 


4 


JOHN 


5 


MARIE 


6 


MARY 


7 


PETE 


8 


ROGER 


9 


ROGER 


10 


ZZZZZ 



Note the following: 

1. The same name can appear more 
than once on the list. The value of J 
returned will be the index of the first 
appearance of the name. 

2. The last value in the file must be 
larger than the last value that could 
appear. The value 77777. will usually 
satisfy this requirement. 

The program in figure 1 sets up the 
sample file shown earlier. With this 
routine, we can enter search values and 
receive index values from the subroutine. 

Enter and run this program for the 
following search values as shown in the 
NM$ column. The response should be 
the index value given in the J column. 



NM$ 


J 


JOHN 


4 


ADAM 





BILL 





YOST 


10 


MARIE 


5 


NANCY 


7 


PETE 


7 



Note that ADAM and BILL both 
return a value of 0, and NANCY and 
PETE both return a value of 7. You will 
have to put a line in your program to 
check whether you have actually found 
the value of NM$, or whether you have 
found the value that would have fol- 
lowed NM$ if it had been on the file. 
The next two lines of coding can be 
added to what you've previously 
entered. These lines allow you to see if 
the value was found or not. Enter them 
and run the program again to check the 
results. 

112 IF N$(J) = NM$THEN PRINT 
■■RECORD FOUND":PRINT:PRINT 

114 IF N$(J) < > NM$THEN PRINT 
"RECORD NOT FOUND":PRINT:PRINT 



Listing 2: Routine to Insert Records 



10 REM *••••••♦♦♦♦««««*«««.*.«.«» 

2 REM ROUTINE TO INSERT RECORDS* 
30 REM *•••••♦•♦••««••♦«•••»««««* 

35 DIM N$(1000) :N-10 

40 DATA BILL,CARL,CARL,DON, JOHN, MARIE, MARY, PETE, ROGER, ROGER, ZZZZZ 

50 FOR I-O TO N 

60 READ N$ (I) 

70 NEXT I 

80 INPUT "ENTER VALUE YOU WANT TO INSERT (ENTER XXX TO STOP)»;NM$ 

90 IF NM$-"XXX" THEN 250 

100 GOSUB 10000 

120 REM *****••••••••**««••♦«***♦* 

130 REM ROUTINE TO INSERT RECORD * 
140 REM •**•••***•♦♦•••••••*«***.* 

150 PRINT"INSERTING RECORD IN FILE" 

160 FOR I=N TO J STEP -1 

170 N$(I+1)-N$(I) 

18 NEXT I 

190 N-N+1 

200 N$(J)-NM$ 

210 PRINT "RECORD INSERTION COMPLETE" 

220 PRINT "*****♦••*••*•***•**•*****. 

2 30 PRINT: PRINT 

2 40 GOTOBO 

250 REM PRINT NEW FILE 

2 60 FOR 1-0 TO N 

270 PRINT N$(I) 

2 80 NEXT I 

2 90 STOP 

10000 REM ***•••••••♦••••*•••••*•.. 

100X0 REM BINARY SEARCH SUBROUTINE* 

10020 REM ************************* 

1003 J-0 

10040 IF J="l THEN 10 200 

10050 IF N<»0 THEN 10200 

10060 IF NM$<N$(0) THEN 10200 

10070 J1-0:J2-N 

10080 J-INT( (Jl+J2)/2) 

10090 IF NM$-N$(J) THEN 10140 

10100 IF NM$<N$(J) THEN J2=J:G0T0 10120 

10110 J1"J 

10120 IF J<>INT((Jl+J2)/2) THEN 10080 

10130 J-J+1:G0T0 10200 

10140 IFJ-0 THEN 10200 

10150 IF J-1 AND NM$.N$(J-1) THEN J-0 : GOTOIO 200 

10160 IF J-1 THEN 10200 

10170 FOR J-J TO 1 STEP -1 

10180 IF NMS<>NS(J) THEN J-J+1:G0T0 10200 

10190 NEXT J 

10200 RETURN 



Now let's see how to insert new 
records into a sorted list. Figure 2 
shows the coding that, along with the 
search subroutine, will perform this 
function. This program will ask you to 
enter values. As you enter them, they 
will be placed in their proper (alpha- 
betical) place in the file. When you 
enter 'XXX' as a record, the program 
will stop and print out your new list. 
You will lose all your new values when 
the program ends, but this isn't serious 
since this is only a test program. In 
practice, you would read all the data in 
from a tape or disk and then write them 
back to a tape or disk when all the 
changes have been made. 

For an exercise, write a delete rou- 
tine. You should be able to model it 
after the insert routine in figure 2. 
Notice that you don't always have to 
check for the full record. You can, for 
example, replace N$(I) with LEFT$ 
(N$(I),3) in the subroutine if you only 



want to check the first three characters 
for a match. 

As you might have guessed, the 
binary search routine can be set up as 
the foundation for a complete file 
maintenance system. If you are able to 
find a record, it's usually a simple mat- 
ter to change it or delete it. The major 
disadvantage is that you must be able 
to hold your entire file in RAM (Ran- 
dom Access Memory] for the length of 
the run. This restricts the size of the 
file you can use. As an extension, you 
might want to write a routine to read 
in, say, 100 records and search through 
them, then read in another 100 records 
and search through them, etc. This 
method would be slower, but it would 
allow you to search disk or tape files of 
any length. 

Contact Mr. Bmey at 201 S. Grinnell St., 
Jackson, MI 49203. 

iiMCftO 



38 



MICRO 



No. 57 - February 1983 



AARDVARK 
TRS-80 COLOR OSI VIC-64 VIC-20 SINCLAIR TIMEX 




TUBE FRENZY 

(by Dave Edson) 
This is an almost indescribably fast action 
arcade game. It has fast action, an all new 
concept in play, simple rules, and 63 levels 
of difficulty. All machine code, requires 
Joysticks. Another great game by Dave 
Edson. TRS 80 COLOR ONLY. 16k and 
Joysticks required. $19.95. 



QUEST - A NEW IDEA IN ADVENTURE 
GAMES! Different from all the others. 
Quest is played on a computer generated 
map of Alesia. Your job is to gather men 
and supplies by combat, bargaining, explor- 
ation of ruins and temples and outright 
banditry. When your force is strong enough, 
you attack the Citadel of Moorlock in a 
life or death battle to the finish. Playable 
in 2 to 5 hours, this one is different every 
time. 16k TRS-80, TRS-80 Color, and Sin- 
clair. 13K VIC-20. $14.95 each. 




AOVENTURESM! 

These Adventures are written in BASIC, are 
full featured, fast action, full plotted ad- 
ventures that take 30-50 hours to play. (Ad- 
ventures are interactive fantasies. It's like 
reading a book except that you are the main 
character as you give the computer com- 
mands like "Look in the Coffin" and 
"Light the torch.") 

Adventures require 16k on TRS80, TRS80 
color, and Sinclair. They require 8k on OSI 
and 13k on Vlc-20. Derelict takes 12k on 
OSI. $14.95 each. 

ALSO FROM AARDVARK - This 
TRS-80 Color and OSI I, business 



CATERPILLAR 

O.K., the Caterpillar does look a lot like a 
Centipede. We have spiders, falling fleas, 
monsters traipsing across the screen, poison 
mushrooms, and a lot of other familiar 
stuff. COLOR 80 requires 16k and Joy- 
sticks. This is Edson's best game to date. 
$19.95 for TRS 80 COLOR. 

PROGRAMMERS! 

SEE YOUR PROGRAM IN THISSPACEI! 

Aardvark traditionally pays the highest com- 
missions in the industry and gives programs 
the widest possible coverage. Quality is the 
keyword. If your program is good and you 
want it presented by the best, send it to 
Aardvark. 

ESCAPE FROM MARS 

(by Rodger Olsen) 
This ADVENTURE takes place on the RED 
PLANET. You'll have to explore a Martian 
city and deal with possibly hostile aliens to 
survive this one. A good first adventure. 

PYRAMID (by Rodger Olsen) 
This is our most challenging ADVENTURE. 
It is a treasure hunt in a pyramid full of 
problems. Exciting and tough I 

HAUNTED HOUSE (by Bob Anderson) 
It's a real adventure— with ghosts and ghouls 
and goblins and treasures and problems — 
but it is for kids. Designed for the 8 to 12 
year old population and those who haven't 
tried Adventure before and want to start 
out real easy. 

DERELICT 
(by Rodger Olsen & Bob Anderson) 
New winner in the toughest adventure from 
Aardvark sweepstakes. This one takes place 
on an alien ship that has been deserted for a 
thousand years — and is still dangerousi 




CATCH'EM 

(by Dave Edson) 
One of our simplest, fastest, funnest, all 
machine code arcade games. Raindrops and 
an incredibe variety of other things come 
falling down on your head. Use the Joy- 
sticks to Catch'em. It's a BALL! — and a 
flying saucer! — and a Flying Yl— and so 
on. TRS 80 COLOR. $19.95. 

BASIC THAT ZOOOMMSI! 
AT LAST AN AFFORDABLE COMPILER! 

The compiler allows you to write your 
programs in easy BASIC and then auto- 
matically generates a machine code equiv- 
alent that runs 50 to 150 times faster. 
It does have some limitations. It takes at 
least 8k of RAM to run the compiler and it 
does only support a subset of BASIC— 
about 20 commands including FOR, NEXT, 
END,GOSUB, GOTO, IF, THEN, RETURN, 
END, PRINT, STOP, USR (X), PEEK, 
POKE, *, /, -^, -, > , < ,=, VARIABLE 
NAMES A-Z, SUBSCRIPTED VARIABLES, 
and INTEGER NUMBERS FORM 0-64K. 
TINY COMPILER is written in BASIC. It 
generates native, relocatable 6502 or 6809 
code. It comes with a 20-page manual and 
can be modified or augmented by the user. 
$24.95 on tape or disk for OSI, TRS-80 
Color, or VIC. 



Please specify system on all orders 
is only a partial list of what we carry. We have a lot of other games (particularly for the 
programs, blank tapes and disks and hardware. Send $1 .00 for our complete catalog. 



w- 



AARDVARK - 80 

2352 S. Commerce, Walled Lake, Ml 48088 

(313)669-3110 

Phone Orders Accepted 8:00 a.m. to 4:00 p.m. EST. Mon.-Fri. 



H 



No. 57 - February 1983 



MICRO 



39 



BASIC Renumber for OSI 



by Paul Krieger 



A BASIC language routine to 
renumber BASIC programs in 
memory and save to tape. 



Renumber 

requires: 

OSI C1P 

This BASIC language routine is written 
for an OSI CI P. It will probably run on 
other OSI machines and, I suspect, 
could be adapted to most Microsoft 
BASIC machines as well. To do this 
you would have to: 1. change X = 769 
throughout the program to the ap- 
propriate starting address for your 
machine, 2. revise the instruction table 
lines 40320-40490 for your particular 
BASIC, and 3. change the syntax of the 
BASIC to your format. 

To operate this program, first key it 
into your machine after a cold start and 
then test it to make sure there are no 
keyboard errors or omitted lines. You 
can test it by typing RUN40280. The 
first message on the screen will be 
"ENTER RANGE OF OLD #'s YOU 
WISH TO UPDATE(LOW,HIGH)". 
Enter the lower number, comma, 
higher number. For the test enter 
40280,41500, which is the range of this 
routine. The program will then ask you 
for the new number (BEGIN,STEP). 
Enter the new beginning number and 
the increment you want between num- 
bers. An appropriate answer for this 
would be 1, 1, which will cause the first 
line to be 1 instead of 40280, and each 
line thereafter will be 1 greater. There 
will be a pause after your reply while 
the program builds the branch table. 

Once the preliminary work is done, 
the progam will type the message 
"START TAPE RECORDER IN 
RECORD/PLAY MODE NOW". This 



indicates it is ready to make the up- 
dated copy of the program. Start your 
recorder using a blank tape and type 
space, return. You will see the program 
listing with the new numbers. After the 
tape is made, you will have the un- 
changed program in memory and a copy 
of it with new line numbers on tape. To 
run the new version press BREAK and 
cold start your machine. Then LOAD 
the tape as you would any other 



program. To renumber any other 
BASIC program, first load it into 
memory then load this renumber 
routine in with it by mounting the 
cassette and typing load again. 

This program relies on the cassette 
tape as a working medium. There are 
two reasons why I chose to write the 
program this way. First, by making a 
tape instead of changing line numbers 
in memory, it is easy to handle line 



Listing 1: Renumber BASIC 

40280 REM ROUTINE TO RENUMBER BASIC BY Paul Krieger 

40290 REM Nov. 8, 1981 

40300 REM BT-BRANCH TABLE, LN-LINE NUMBER OF DESTINATION 

40 310 DIMIT$(67);DIMBT(200) :DIMLN(200) 

40 320 IT$(0)-"END":IT$(1)-"FOR":IT$(2)-"NEXT":IT$(3)-"DATA" 

40330 IT$(4)-"INPUT"!lT$(5)-"DIM":IT$(6)-"READ":IT$(7)-"I.ET" 

40 3 40 IT$(8)-"GOTO":IT$(9)-"RUN":IT$(10)-"IF";IT$(11)-"RESTORE" 

40 350 IT$(12)-"GOSUB":IT$(13)-"RETURN":IT$(14)-"REM":IT$(15)-"STOP" 

40 360 IT$(16)-"ON":IT$(17)-"NULL":ITS(18)-"WAIT"!lT$(19)-"LOAD" 

40 370 IT$(20)-"SAVE"lIT$(21)-"DEF":ITS(22)-"POKE":IT$(23)-"PRINT" 

40380 IT$(24)-"C0NT":IT$(25)-"LIST"!IT$(26)-"CLEAR":IT$(27)-"NEW" 

40 390 IT$(28)-"TAB"!lT$(29)-"T0":IT$(30)-"FN":IT$(31)-"SPC(" 

40400 IT$(32)-"THEN":IT$(33)-"NOT":IT$(34)-"STEP":IT$(35)-"+" 

40410 IT$(36)-"-":IT$(37)-"*";IT$(38)-"/":IT$(39)-"A" 

40420 IT$(40)-"AMD"!lT$(41)-"0R":IT$(42)-">":IT$(43)-"-" 

404 30 IT$(44)-"<";IT$(45)-"SGN":IT$(46)-"INT":IT$(47)-"ABS" 

40440 IT$(48)-"USR"lIT$(49)-"FRE":IT$(50)-"POS":IT$(51)-"SQR" 

40450 IT$(52)-"RMD":IT$(5 3)-"LOG":IT$(54)-"EXP":IT$(55)-"'COS" 

40460 IT$(56)-"SIM":IT$(5 7)-"TAN":IT$(58)-"ATN":IT$(59)-"PEEK" 

40470 IT$(60)-"LEM"!lT$(61)-"STR$":IT$(62)-"VAL":IT$(6 3)-"ASC" 

40480 IT$(6 4)-"CHR$":IT$(65)-"LEFT$":IT$(66)-"RIGHT$" 

40490 IT$(67)-"MID$" 

40500 REM INITIALIZE 

40510 PRINT "ENTER RANGE OF OLD t'S YOU WISH TO UPDATE" 

40520 INPUT"(L0W,HIGH)";LR,HR 

40530 INPUT"ENTER new NUMBER: (BEGIN, STEP)" :BG , ST 

40540 X-769JREM BEGIN OLD DESTINATION PASS "ODP" 

40550 Q-OtREM SET TABLE INDEX TO BEGINNING 

40560 NA-PEEK(X+1) :REM GET NEXT INSTRUCTION HIGH BYTE 

40570 NA-NA*256:REM SETUP HIGH 

40580 NB-PEEK(X):NA-NA-t-NB:REM ADD IN LOW 

40590 REM NA IS NEXT ADDRESS, NB IS WORK 

40600 IFNA>0THEN40980:REM EXIT OLD DEST PASS 

40610 L-PEEK(X+3) ;L-L*256:NB-PEEK(X+2) :L-L+NB 

40620 IPL>HRT8EN40980 

40630 W-X+4JREM TO TEXT OF INST 

40640 FORI-0TO72:REM SCAN FOR BR 

40650 C-PEEK(W+I) ;REM BRANCH TABLE ARGUMENT 

40660 REM 144-ON, 44-COMMA AFTER "ON" 

40670 REM 1 36-GOTO, UO-GOSUB, 160-THEN, n7-RUN 

40680 IPC-I44THENS-l!REM "ON" SET SWITCH TO 1 

40690 IFS-1THEN40720 

40700 IFC-I36ORC-I40ORC-I60ORC-137THENGOSUB40 7 7O 



40 



MICRO 



No. 57 - February 1983 



Listing 1: Renumber BASIC (continued) 

40710 GOTO40730 

40 720 IFC-136ORC-U0ORC-160ORC-13 70RC-44THENGOSUB407 70 

40730 IFC-OTHENI-72!S-0:REM RESET "ON-GOTO" SWITCH 

40740 NEXTI 

407S0 X-NA!GOTO40S60:REM CONTINUE U NEXT LINE 

40760 REM ENTER HERE FOR BRANCHING ONLY 

40770 REM I NOW POINTS AT POSSIBLE "THEN" 

40780 IFCO160THEN40800 

40790 B-PEEK(I+W+1) :IFB>57THENRETURN:REM "THEN" W EXPR-IGNORE 

40800 B-C 

40810 FORK-0TO6;REM FIND LEFTMOST * OF DESTINATION 

40820 C-PEEK(K+I+W) 

40830 IFC>47ANDC<58THENK-K+6 

40840 NEXTK 

40850 KR-K-6:REM FIND RIGHT SIDE 

40860 FORK-KRTOKR+6 :C-PEEK(K+I+W) 

40870 IFC<480RC>57THENK-K+6 

40880 NEXTK 

40890 K-K-8 

40900 J-10 

40910 BT(Q)-PEEK(K+I+W) : BT(Q)-BT(Q) -48 

40920 K-K-1 

40930 C-PEEK(K+1+W) 

40940 IFC<48ORC>57THEN40970 

4095 C-C-48!C-C*J:J-J*10:BT(Q)-BT(Q)+C 

40960 GOT040920 

40970 C-B:Q-Q+l!RETURN 

40980 REM LINK TO DESTINATION 

40990 X-769 

41000 BD-BG 

41010 NA-PEEK(X+1) !NA-NA*256:NB-PEEK(X) :NA-NA+NB 

41020 IFNA-0THEN41130 

41030 L-PEEK(X+3) ! L-L*256 ;NB-PEEK(X+2 ) :L-L+NB 

41040 IFL>HRTHEN41130 

41050 FORq-OT0200iREM LINK OLD TO NEW 

41060 Y-X+3:LN-PEEK(Y):LN-LN*256:REM HIGH OF LINE # 

41070 Y-X+2;L0-PEEK(Y) !LN-LN+LO;PRINTLNj !REM PRINT LINE # 

41080 NEXTQ 

41090 IFL<LRORL>HRTHEN41110 

41100 BD-BD+ST 

41110 X-NA:G0T041010 

41120 REM RENUMBER 

41130 SAVE!PRINT"START TAPE RECORDER IN RECORD/PLAY MODE NOW" 

41140 INPUT"PRESS SPACE/RETURN WHEN PAST LEADER"jB$ 

41150 Q-0 

41160 X-769 

41170 NA-PEEK(X+1) :HA-SA*256 :NB-PEEK(X) !tJA-tJA+UB 

41180 IFNA-0TUEN41S00 

41190 Y-X+3:LN-PEEK(Y) ;LN-LN*256iREM HIGH OF LINE # 

41200 Y-X+2:L0-PEEK(Y) : LN-LN+LOi IFLN>HRTHEN4 1500 

41210 IFLN<LRORLN>HRTHEN41240 

41220 PRINTBG; :BG-BG-t-ST 

41230 G0T0412S0 

41240 PRINTLNj!REM PRINT LINE* 

41250 W-X-t-4 

41260 FORI-0TO72 

41270 C"PEEK(W+I) 

41280 IFC-OTHENX-NA: 1-7 3: G0T04 1430 

41290 IFC-44THENPRINTCHR$(C) ; :COT041340 

41300 IFC<1280RC>195THEN41420 

41310 C-C-128!PRINTIT$(C) i 

41320 IFLN<LRORLN>HRTHEN41430 

41330 C-C+128:IFC-160THENB-PEEK(W+I+1) ;IFB>57THEN4 1430 

41340 IFC-144THENS-l!REM SET "ON-COTO" SWITCH 

41350 IFS-1TUEN41380 

41360 IFC-136ORC-14OORC-160ORC-137TUEN4140O 

41370 G0T041430 

41380 IFC-1360RC-1400RC-160ORC-1370RC-44THEN41400 

41390 GOTO41430 

41400 GOSUB41460 

41410 I-I-)-B-ltGOT041430:REM BYPASS NEW DEST # 

41420 PRINTCHR$(C) ; 

41430 NEXTI 

41440 S-0!PRINT 

41450 GOT041170 

41460 B$-STR$(LN(Q)) :B-LEN(B$) :PRINTRICHT$(B$ , B-1) ; 

41470 B-LEN(STR$(BT(Q))) :REM PRINTING NEW LINE # 

41480 q-Q+1 

41490 RETURN 

41500 rORDL- 1T04000 !NEXTDL:P0KE5 17 ,0 : END 



numbers that can vary from one digit to 
as many as five. Second, by making a 
tape, the program can renumber itself, 
which it could not do if it were changing 
memory. A byproduct is that a copy of 
the original program is still in memory 
in case there are bugs in this renumber- 
ing routine. 

BASIC is kept in memory in a com- 
pressed format. The first two bytes are 
the address of the next instruction in 
memory. This is a binary value with a 
range of from 771 to 65383. The next 
two bytes are the current BASIC line 
number, which is also in binary. The 
range of this field is to 63999. Then 
comes the text of the BASIC instruc- 
tion. Any BASIC command, statement, 
operator, or function is reduced to a 
single character in the range 128 ($80) 
to 195 ($C3). 

A line number destination [branch), 
as in a GOTO, is kept in the graphic 
format. To renumber in memory it is 
necessary to deal with the branch line 
numbers by expanding or compressing 
each line in memory from the end of 
the subject line to the end of the BASIC 
instructions. 

The fourth line of the program in- 
cludes two dimension statements using 
200. This represents the maximum 
number of branches in a program. So far 
this has worked fine for me, but you 
may wish to make this value larger or 
smaller according to the size of your 
programs or memory or both. 

If you load this routine into mem- 
ory and all the line numbers are larger 
than those already in memory, there 
probably won't be a timing problem. If 
the line numbers of this routine are 
smaller than those already in memory, 
there may be a timing problem as the 
machine will relocate all the instruc- 
tions in memory once for each line read 
in. If this is the case, you will see par- 
tial lines being read from the tape and a 
lot of error messages on the screen. You 
can overcome this problem by placing 
some nulls in the renumber program 
prior to creating the master tape. 



The author may be contacted at 3268 S. 
Cathay Cr., Aurora, CO 80013- 



JMCRO 



No. 57 - February 1 983 



MICRO 



41 



>TM >\^ 



AmouNcimclectroScreen 

the Superior Alternative .jr^ 



on»V. 

$595 



to the Traditional Alphanumeric Terminals 




The ElectroScreen" intelligent Graphics Board Features: 



Graphics 

• 512 X 480 resolution bit-mapped display 

• Interleaved memory access — fast, snow-free updates 

Intelligence 

• 6809 on-board mpu 

• 6K on-board firmware 

• STD syntax lilgh level graphics command set 

• Removes host graphics software burden 

• Flexible text and graphics integration 

• Multiple character sizes 

• User programs can be run on-board 



Terminal 

• Terminal emulation on power-up 

• 83 characters by 48 lines display 

• Easy switching among user-defined character sets 

• Fast hardware scrolling 

Additional Features 

• SS-50C and SS-64 compatible board 

• Board communicates with host through parallel latches 

• Composite and TTL level video output 

• 8 channel 8 bit A/D converter 

• Board occupies 4 address bytes 



See your dealer today! 

The ElectroScreen manual is available for $10, credited toward purchase of the board. 



The ElectroScreen has a 90 day 
warranty from purchase date. 

Dealers, please contact us for our 
special Introductory package. 

42 




Privacinc 



MICRO 



(703)671-3900 

3711 S. George Mason Dr., Falls Church, Va. 22041 

No. 57 - February 1983 



LANGUAGES 



SuperPET APL 



by Terry Petersen 



This article gives a brief 
description of several APL 
textboolcs currently available, an 
overview of APL in general, and 
the SuperPET's microAPL in 
particular. 



Before I owned a Commodore Super- 
PET, I had heard of a programming 
language called APL but never had ac- 
cess to a machine that could run it. 
Therefore, my curiosity about this un- 
tried language influenced my decision 
to buy a SuperPET. I think it is fair to 
say microAPL is the most unorthodox 
of the languages supplied with the 
SuperPET. Programmers raised on 
FORTRAN and BASIC refer to it as 
"the closest to hieroglyphics I've ever 
seen," and "a write-only language." 
MicroAPL is also the largest of the four 
interpreters by Waterloo Computer 
Systems, Ltd. (WCS) that came with 
my SuperPET (it nearly fills the 64K 
bank-switched expansion RAM). Con- 
versely, it has the smallest user manual 
— 108 pages versus 137 for microPascal 
and 221 for microBASIC. I soon con- 
cluded I needed more help getting 
started in APL than was available in the 
Waterloo documentation. To learn 
more about the language I pestered my 
local librarian to obtain several APL 
textbooks via interlibrary loan. 

Books on APL 

APL inventor Kenneth Iverson 
wrote the first book about the lan- 
guage. Published in 1962, it is entitled 
A Piogiamining Language.^ It describes 
some of the rationale of APL and how 
to implement it. I recommend Mr. Iver- 
son' s book only to those interested in 
APL's guts — it is not a good tutorial 
for learning to write APL programs. 

Books in Print currently lists about 
a dozen APL textbooks. I borrowed five 



of them, selected more or less at ran- 
dom, all of which are better than the 
original for learning APL programming. 
I found the most folksy approach to 
teaching APL in Howard A. Peelle's 
APL: An Introduction.'^ Written in an 
unusual style, this book is organized 
into nine tutorial sessions. The pages 
are printed to look like an APL terminal 
printout with hand- written notes added. 
The lessons seem easy to follow and 
there are frequent questions for the 
reader to test his understanding of the 
material. I think this book is a good in- 
troduction to APL for those with little 
or no computer experience. Others will 
probably find it a bit plodding. 

APL: An Interactive Approach by 
Leonard Gilman and Allen J. Rose^ also 
assumes no particular computer or 
mathematics background. The book is 
geared to IBM equipment, as are all the 
others I've seen, but it is fairly com- 
plete in describing the language ele- 
ments, and is quite usable with the 
SuperPET as long as you ignore the in- 
formation about workspace storage, 
etc. (Note: In APL you save and load 
workspaces rather than programs.) 
This book seems to be more widely 
available than Peelle's; I foimd it in a 
imiversity bookstore. 

Of the five textbooks I selected, my 
favorite is Handbook of APL Piogiam- 
ming by Clark Wiedmarm.* This book 
is more terse than Iverson' s or Rose's, 
but is more explanatory than WCS's 
manual. The copy I borrowed from the 
library was clothbound, but the copy- 
right information page indicates it is 
available in paperback also. 

APL Piogramming and Computer 
Techniques by Harry Katzan, Jr.^ is 
notable for its inclusion of several real 
APL programs for study. The edition I 
saw, however, was published in 1970 
and appears rather dated; for example, 
there is no mention of the domino 



function. Perhaps later editions are 
more up-to-date. 

Finally, I looked at A Course in APL 
with Applications by Louis D. Grey.* 
This book seems to me to have been 
hastily prepared, with many (typo- 
graphical?) errors as well as what ap- 
pear to be outright program errors. 
Such confusion does not contribute 
positively to the learning experience 
and is most unwelcome in a textbook. 

Accessible Programming 

When Keimeth Iverson invented 
APL, FORTRAN was practically the 
only high-level language available for 
scientific programming. At that time 
FORTRAN dialects were very restric- 
tive and demanded that the program- 
mer be a fairly sophisticated com- 
puterist. Even if you could get your pro- 
gram to compile successfully, there 
was a good chance some esoteric fea- 
ture of the compiler's method of inter- 
nal number representation would give 
imexpected results. 

The main intent of Iverson' s new 
language was to make programming 
more accessible by freeing program- 
mers (still presumed to be mathe- 
matically oriented) from mundane con- 
siderations, such as whether or not a 
number is stored in the computer in in- 
teger or floating-point form, or whether 
or not a particular variable is a scalar or 
an array of dimension x. APL achieves 
this intent; the same APL variable may 
contain (at different times during pro- 
gram execution] integer, floating-point, 
or even character data, and it may 
become a scalar or an array merely by 
assigning such data to it. A very power- 
ful side-effect of this lack of 'type' is 
that an APL 'function' may return with 
no difference in coding scalar, vector, 
or array results, depending only on 
given argument(s)! 

Compared to other languages of the 



No. 57 - February 1983 



MICRO 



43 



LANGUAGES 



early sixties, APL is certainly a paragon 
of versatility. Even today, I think it is 
unmatched in its freedom from variable 
types. This freedom comes at a price, of 
course. Since there are no declarations 
of variable types (as in Pascal) nor im- 
plicit types [as in FORTRAN and 
BASIC), you are forced to discover from 
its context what kind(s) of data a 
variable contains. This process of 
discovery can be puzzling and time- 
consuming when you read an APL pro- 
gram written by someone else — or 
yourself, six months earlier. 

Also, since APL tends to substitute 
array operations for things that would 
be written as loops in other languages, 
its coding is unusually compact. I 
doubt that even the most experienced 
APL programmers skim through un- 
familiar APL code the way you might 
with Pascal or well- written BASIC. 
However, APL's compactness does 
have its virtue: microAPL is the Super- 
PET's fastest interpreter, hands-down. 
There simply isn' t as much source code 
to scan in performing a given task as in 
other languages. For example, consider 
as a benchmark the filling of an array 
with the sequence 1, 2, 3, ..., 1000. 
This task takes (as coded below) 11 
seconds in microBASIC, 5.25 seconds 
in CBM BASIC, and only 1.18 seconds 
in microAPL. 

APL Implementations 

APL implementations, including 
microAPL, contain many more built-in 
functions than are found in most other 
languages, even on mainframe com- 
puters. There are functions for finding 
the maximum or minimum value in an 
array, sorting arrays, and 'cutting' and 
'pasting' arrays to make smaller or 
larger arrays. There is even a function, 
called the 'domino,' for finding the 
'least-squares' fit of data to a model 
equation! [Domino will also, trivially, 
invert a matrix.) 

Aside from being rather difficult to 
read, APL's worst deficiency, in my 
estimation, is its primitive branching 
mechanism. Its only branch instruc- 
tion is a close relative of BASIC'S 'ON 
X GOTO 1,...,N.' There is no IF... 
THEN... ELSE, WHILE..., UNTIL..., 
etc. — in short, no stmctuied program- 
ming. This is not as bad as it sounds 
because APL's rich complement of 
built-in functions and extensive use of 
arrays obviate many loops and branches. 
However, since it lacks the sorts of 
program-flow control statements found 



in most other, more modem, lan- 
guages, efficient APL coding requires a 
different programming style and mind- 
set. For example, the array-filling 
benchmark mentioned above is coded 
in BASIC as follows: 



100 DIM A(1000) 
110 FOR I = 1 TO 1000 
120 A(l) = I 
130 NEXT I 



In APL it is written as: 
A *- 1000 e I 1000 



where the meaning of the above one- 
liner is ' 'Assign to A the 1000-element 
vector formed from the integers 1 to 
1000." It's not too hard to see why the 
APL interpreter makes such short work 
of this benchmark. It scans one short 
line of source while the poor BASIC in- 
terpreter is stuck with scanning lines 
120 and 130 a thousand times! 

As an example of how not to write 
APL, you could code this benchmark 
more closely to the BASIC version 
this way: 



A *- 1000 eO 
I *- 1 
XX: A[l] «- I 
I «- I -I- 1 
-(I < 1001)/ XX 



where the meaning of these APL lines 
may be guessed by comparison with the 
BASIC version. This awful mess takes 
121 seconds to run and is a glaring ex- 
ample of what might be called 'pidgin 
APL.' I hope my remark about mindset 
is now clear. 

I should hasten to add, for the 
benefit of any fervent structured- 
programming enthusiasts, that it is 
possible to impose some of the 
cosmetics of structured programming 
on APL in order to make it more 
readable. If you have a SuperPET, see 
the excellent work done by an 
anonymous WCS programmer in the 
sample workspace "MASTERIVUND" 
on the SuperPET tutorial diskette. This 
sort of veneer, however, doesn't really 



make up for the lack of control 
statements in APL. 

A feature APL does share with 
modem structured languages is the 
high degree of modularity. APL pro- 
grams usually are written as a collec- 
tion of functions, similar to Pascal pro- 
cedures and functions, which may use 
either local or global variables. Each 
function may have zero, one, or two 
arguments, and may or may not retum 
an explicit result. The limitation to 
two arguments is not as restrictive as 
you might imagine because each argu- 
ment can be an array. However, any 
assumption within the function about 
the rank of its arguments reduces its 
generality. For example, consider the 
following APL function: 



[0] Z *- EQUALS 3 A 
[1]Z*-A = 3 



If A is a scalar, the function EQUALS 3 
returns a scalar value of 1 if A is 3 and 
returns otherwise. In addition, if A is 
any numeric array whatever, this func- 
tion will retum an anay of I's and O's 
of the same shape as A. On the other 
hand, the following function will ac- 
cept only one type of argument — a 
numeric vector (and it ignores all but 
the first three elements) : 



[0] VOLUME *- PARALLELAPIPED X 
[1] VOLUME *- X[1] X X[2] X X[3] 



As you might suspect, this is another 
example of pidgin APL. A more proper 
APL version of PARALLELAPIPED 
would be: 



[1] VOLUME «-x/X 



This second version uses the 'reduc- 
tion' (/) operator to signify multiple ap- 
plication of the X's operator. In this 
version a vector argument would result 
in the scalar product of all the elements 
of the vector; and an array argument 
would yield an array of one lower rank 
(one less subscript) with each element 



44 



MICRO 



No. 57 - February 1983 



LANGUAGES 



equal to the product of the elements of 
the argtiment array obtained by fixing all 
but the last subscript! (Mindset again.] 
APL's extensive use of arrays tends 
to require large amounts of memory. 
On the SuperPET this is particularly 
troublesome because the microAPL in- 
terpreter stores all numeric quantities 
in floating-point form, requiring five 
bytes each. Furthermore, microAPL 
doesn't allow all the available RAM to 
be used for variable storage. I haven't 
worked out just how the division be- 
tween program and variable space is 
decided, but it works out such that an 
otherwise empty workspace cannot 
contain even one 3000-element 
numeric array. However, it can contain 
four 1000-element arrays! In most 
cases, it seems you probably will run 
out of variable space before the user 
RAM is actually full. The RAM- 
gobbling situation could be reduced 
dramatically if some form of byte- or 
integer- (double-byte) numeric storage 
could be used where appropriate. 

APL Character Set 

APL has a strange character set. The 
wealth of built-in functions of APL are 
invoked via a vast array of unusual 
characters. I find this a problem even 
though I'm familiar with the Greek 
alphabet; those who are not face even 
greater difficulty. The situation in APL 
could be compared to requiring BASIC 
programmers to read and write their 
programs in the 'tokens' used internally 



by the interpreter instead of English 
keywords. It's a pity Mr. Iverson didn't 
invent the keyword-token translator 
along with the rest of APL. 

Besides requiring memorization, 
the characters of APL present a prac- 
tical problem when printing and typing 
them. There are special APL print- 
wheels available for daisy-wheel 
printers, and some dot-matrix printers 
may be programmed to 'draw' APL 
characters; but the APL keyboard is 
still troublesome. There are so many 
APL characters they won't fit all at 
once on a regular keyboard, so some of 
them are formed by ' overs triking' to 
make one character out of two simpler 
characters. This is awkward and re- 
quires you to remember which two 
characters to use. Mercifully the two 
characters may be typed in either order. 
[Ed. note: Terry had to limit his pro- 
gram examples to ones containing the 
Greek and math characters our typeset- 
ter has.) 

In summary, there are things I like 
very much about APL. Its free-form 
variables permit very elegant and clever 
coding of mathematical problems. (I've 
written a one-line function that com- 
putes the next generation of a LIFE 
game, but I can fill only about half the 
screen because of the SuperPET' s RAM 
limitation.) There are also things I 
dislike about APL. Its odd character set 
and lack of flow-control statements are 
anachronisms. MicroAPL, specifically, 
seems to be a pretty faithful implemen- 



tation of the IBM language, as adver- 
tised. It could benefit significantly, 
however, from some micro-oriented ex- 
tensions, such as integer- or byte- 
numeric arrays (perhaps resulting from 
Boolean operators) . Being a polyglot at 
heart, I have enjoyed learning such an 
unusual language as APL. 

Bibliography 

1. Iverson, KennethE., A Piogiamming 
Language, John Wiley & Sons, Inc., 
New York, 1962. 

2. Peelle, Howard A., APL: An Intio- 
ducdon, Hayden Book Company, 
Inc., Rochelle Park, New Jersey, 
1978. 

3. Gilman, Leonard and Rose, Allen [., 
APL: An Intemctive Appioacb, John 
Wiley & Sons, Inc., New York, 
1976. 

4. Wiedmann, Clark, Handbook of APL 
Piogiamming, Petrocelli Books, 
New York, 1974. 

5. Katzan, Jr., Hairy, APL Piogiam- 
ming and Computei Techniques, 
Van Nostrand Reinhold Company, 
New York, 1970. 

6. Grey, Louis D., A Couise in APL 
with Applications, Addison-Wesley 
Publishing Company, Inc., Philip- 
pines, 1976. 



You may contact Mr, Peterson at 8628 
Edgehill Ct., El Cerrito, CA 94530. 

JMCftO 



What's Where in the Apple 

A Complete Guide to the Apple Computer 



This REVISED EDITION of the 
famous Apple Atlas provides Apple 
computerists with a frameworl< for 
understanding both the overall 
organization and structure of the 
Apple system and programming 
techniques that exploit that 
knowledge. 

What's Where in the Apple contains 
the most complete memory map 
ever published as well as detailed 
Information needed for actual 
programming. 

All for only $24.95 
(plus $5.00 s/h) 



For owners of the original edition, 
MICRO is offering a companion 
bool<, THE GUIDE to What's Where 
in the Apple, for only $9.95 (plus 
$2.00 S/h) 

THE GUIDE contains all new 
material that explains and 
demonstrates how to use the atlas 
and gazetteer published in the 
original volume of What's Where in 
the Apple? 

MICRO makes it easy to order: 
Send check (payable to MICRO) to: 



...NNV^er 



NNV^a^^j;pp\,t 




VISA and MasterCard accepted 
MA residents add 5% 



MICRO INK P.O. Box 6502 Chelmsford, MA 01824 

Call our toll-free number: 1 ■800-354-81 12 (in PA, 1-800-662-2444) 



No, 57 - February 1983 



MICRO 



45 



FOR YOUR APPLE II 

Industry standard products at super saver discount prices 





PARALLEL PRINTERS 
NEC 8023 or C-ITOH 8510 

(Virtually identical) Specifications: • 100 CPS dot 
matrix printer • 80 column print- 136 characters 
per line • Tractor/friction feed • 7 different print 
fonts included • 2K printer buffer • Proportional 
spacing • Bit image graphics and graphic symbols. 

NEC 8023 or C-ITOH $495 

NEC 8023 or C-ITOH 8510 with 

Parallel Interface and Cable $550 

EPSON 100 with Parallel Interface 

and Cable $749 



Z-80 CARD FOR YOUR APPLE 
MICROSOFT SORCARD 

With CP/M" and MBASIC. 

(List: $399) $289 

- -•^^-'i BeslBuyH! 
<WSL ADVANCED logic system 
^PF^ Z-CARD WithC-PM- 

Has everything the Softcard has except MBASIC. 
Works with Microsoft's disks too. 

(List $269) Special at $195 

ALS SYNERGIZER 

CP/M' operating package with an 80 column 
video board, CP/M" interface, and 16K memory 
expansion for Apple II. Permits use of the full 
range of CP/M' software on Apple II. Includes 
SuperCALC. 

(List: $749) $549 

■ ji^ U-Z-80 PROCESSOR BOARD 
^fif^ (From Europe) 

Software compatible with Softcard and 

ALS Software $149 

MICROSOFT -I- PREMIUM SYSTEM 

Includes Videx Videoterm, Softswitch, Microsoft 
and Softcard, Microsoft and Z-80 Card, and 
Osborn CP/M- Manual $595 



•-""^^^ JOYSTICK 

^"^ -^J^^ril^^ T3\^es the place of two 
^^0^^^% Apple Paddle Controllers. 

From BMP Enterprises. Heavy duty industrial con- 
struction and cable. Non-sell centering. With 
polarity switches for consistent motion control. 

(List: $59) $39 

MONITORS FOR YOUR APPLE 

AMDEK 300G 

(18MHZ Anti-Glare Screen) $179 

NEC 12" HIRES GREEN $179 

SUPER SPECIAL! 
SPECIAL 12" GREEN MONITOR $99 



SPECIAL AND NEW 

5 MEGABYTE HARD DISK 

For Apple II. Supplied with controller. Use with 
CP/M, Apple DOS, & Apple Pascal $1995 

5V4" DISK DRIVE 

Use with standard Apple II disk controller. .$295 

51/4" FLOPPY DISKS 

Withhubrings.Boxof 10. 

With other purchase $19.95 

Without purchase $23.00 

16K MEMORY EXPANSION MODULE 

The preferred 16K RAM Expansion Module from 
PROMETHEUS. Fully compatible with CP/M' and 
Apple Pascal". With full 1-year parts and labor 
warranty. (List: $169) $75 

WORD PROCESSING SPECIAL 
WITH WORDSTAR AND SUPERCALC! 

Do professional word processing on your APPLE. 
All necessary hardware and software included. 
Complete 80 column video display, enhanced 
character set, 16K memory board, Z-Card with 
CP/M" software, Wordstar and word processing 
software and SuperCALC. 

^ ,^t.^ (List: $1,128) . . . .Special at $695 

^PpT'/rDm Prometheus! Expa nda RAM 

The only 128K RAM card that lets you start with 
16K, 32K, or 64K of memory now and expand to 
the full 128K later. Fully compatible with Apple 
Pascal, CP/M", and Visacalc. No Apple modifi- 
cation required. Memory management system in- 
cluded with all ExpandaRAMs. Disk emulators 
included with 64K and 1 28K versions. 

MEM-32 Two rows of 16K RAMS 

make a 32K RAM Card $209 

MEM-64 One row of 64K RAM. 

With DOS 3.3 disk emulator $299 

MEM-128 Two rows of 64K RAMS installed 

makea128KCard. 

With DOS 3.3 disk emulator $399 

MEM-RKT 64KRAMAdd-0n-Kits- 

64K Dynamic RAMS. Each .... $125 
VISICALC Expansion Program 

for MEM-128 $75 

MEM-PSL Pascal disk emulator for 

MEM-128 $45 

MODEMS FOR YOUR APPLE li 

HAYES Smartmodem $229 

MICROMODEM II $279 




VERSAcard FROM PROMETHEUS 

Four cards on one! With true simultaneous opera- 
tion. Includes: (1) Serial Input/Output Interface, 
[2) Parallel Output Interface, (3) Precision Clock/ 
Calendar, and (4) BSR Control. All on one card. 
Fully compatible with CP/M" and Apple Pascal". 

(List: $249) $169 




80 COLUMN 

VIDEO DISPLAYS 

FOR APPLE II 

SMARTERM 

(Not to be confused with SUPRTERM) 

Software switching from 80 to 40 and 40 to 80 
characters. 9 new characters not found on the 
Apple keyboard. Fully compatible with CP/M" and 
Apple PASCAL'. With lowest power consumption 
or only 2.5 watts. 

(List: $345) $225 

SMARTERM EXPANDED CHARACTER SET 

7" X 11" matrix with true decenders. Add to 
above $40 

„ „ . Combination SMARTERM and 
Best Buy! EXPANDED CHARACTER SET 

Special at $260 

VIDEX, VIDEOTERM $249 

VIOEX ENHANCER II $119 

M^jk CENTRONICS COMPATIBLE 
iPlr PARALLEL INTERFACE 

From PROMETHEUS. For use with Epson, NEC, 
C-ITOH, and other printers. Fully compatible with 
CP/M* and Apple Pascal*. 

PRT-1,0nly $69 

GRAPHini CARD 

Prints HIRES page 1 or 2 from onboard firmware. 
Features: True 1:1 aspect ratio, prints emphasized 
mode, reverse mode, rotates 90 degrees . . . plus 
more. Compare all this with the Grappler. We think 
you'll agree that this is the best graphics card on 
the market. Specify for use with EPSON, NEC- 
8023, C-ITOH Prowriter, orOkidata. 

(List: $125) $89 

SOFTWARE 

WORDSTAR Special at $195 

SPELLSTAR $125 

SUPERCALC $175 

D BASE II $525 

VISICALC $149 

DB MASTER $189 

All equipment shipped factofy fresh. Manufacturers warranties 
included. Please add S3. 00 per product for shipping and handling, 
California: add 6% tax: BARt Counties: 6V27o 

All items are normally in stock 

Rhone for Quick 
Shipment! 

[41S)490'3420 

. . . And we'll be here to help after you 

receive your order. Feel free to call the SGC 

Technical Staff for assistance. 

The mail order speeiatists 

342 Quartz Circle, Livermore, CA 94550 




46 



MICRO 



No. 57 - February 1983 



LANGUAGES 



EDIT: An ATARI FORTH 
Screen-Oriented Editor 



by Mike Dougherty 



EDIT uses the Atari 800 display 
as a text window into a FORTH 
disk screen, and allows full use 
of the Atari special function 
keys to prepare FORTH 
applications. 



EDIT 

requires: 

Atari 800 with 24K 
Atari 810 disk drive 
APX fig-FORTH 

The Atari Program Exchange version of 
FORTH, "APX fig-FORTH," comes 
with the sources for two line-oriented 
editors on disk. Although line editing is 
greatly enhanced by using the Atari 
screen edit keys, a general video screen 
editor makes software development 
easier. EDIT implements a video screen 
editor for the Atari 800. This 2.6K-byte 
application can be modified to run on 
most memory-mapped video FORTH 
systems. With modification of the low- 
level terminal words, EDIT should be 
adaptable to FORTH systems contain- 
ing a serial terminal with an ad- 
dressable cursor. 

EDIT Design 

The two objectives of EDIT are to 
provide a useful video screen editor and 
to maintain full compatibility with 
APX fig-FORTH. Specifically, the 
following points are considered: 

1. Retaining FORTH's 16-line by 
64-character text screen. 

2. Making FORTH LISTs or TRAIDs of 
edited screens visually acceptable. 

3. Allowing screens to be compiled by a 
FORTH LOAD. 

4. Making the video reflect the current 
state of the text. 

5. Causing the video screen editor to 
execute with the Atari's default 
38-character line length. 



Listing 1: EDIT for Atari APX fig-FORTH 



SCR 

1 



# 60 

< 



bv Mike Dougherty 



2 ( APX -fig-Forth Screen Editor 

3 ( 

4 ( 

5 ( 

( This editor allows the user 

'. to edit a Forth screen using 

( the Atari display as a te::t 

( window into the Forth screen 

( To load EDIT: 60 LOAD 

< To EDIT screen #n: n EDIT 



SCR 

1 



lb 

7 

a 

9 

10 
11 

12 
13 
14 
15 



SCR 

1 



# 61 

< CONSTANTS / VARIABLES FDR EDITOR 



VARIABLE 
VARIABLE 
3 VARIABLE 
3 VARIABLE 

IB CONSTANT 
2 CONSTANT 

22 CONSTANT 
VARIABLE 

17 VARIABLE 



CLINE 

CCHAR 

LINEOFF 

CHARDFF 

TOP-BOT 

REDGE 

LEDGE 

SIDE 

EXTRAOFF 



( Current line number, iZl-15 

( Current char number, 0-&3 

( 0-f+set -for 1ST text line 

( 0-f + set for le-ft margin 

< Top ■?? bottom window char 

( Right edge window char 

( L.e-ft edge window char 

( Current side of screen 

( Extra line screen position 



VARIABLE STOP 

VARIABLE BAV-BUF 64 ALLOT 



# 62 

! READ SCREEN SCR INTO MEMORY ) 



( Editor exit flag 

( Buffer for deleted line 



( 



) 



16 DO 

I SCR .3 (LINE) 
DROP UPDATE DROP 

LOOP 



CLINE 
CCHAR 
SIDE 



( Initiali: 
( ... 



4 
5 
6 

7 

a 

9 
10 

11 

12 
13 
14 
15 



SCR # 63 

( PR I MAT I VE SCREEN MANIPULATIONS ) 
1 

2 : ECLEAR ( ) 

3 XGR ( Clear 



( For each line of the screen ) 
( Read .!< get the ADDR, LENGTH ) 
( Mark the block of memory ) 
( next screen line ) 



to 1ST LINE ) 
to 1ST CHAR ) 
to LEFT SIDE ) 



1 752 



6 


: POINT-CURSOR 


7 


85 ! 


8 


84 C\ ; 


9 




10 


: CURS0R3 


11 


CLINE a LINEOFF S + 


12 


CCHAR 3 


13 


SIDE 3 IF 32 - ENDIF 


14 


CHAROFF S + ; 


15 


— ■> 



/ideo via GRAPHICS ) 
( Inhibit ATARI system cursor ) 

( row col ) 

( Save col in system shadow ) 
( Save row too — only 1 byte ) 



( — ■- row col ) 

( Compute vi deo posi t i on ) 

( Base value -for col ) 

( Adjust if RIGHT side ) 

( Add le-ft margin ) 



No. 57 - February 1983 



MICRO 



47 



LANGUAGES 



6. Performing logically equivalent 
functions on the screen text with all 
special edit keys of the Atari 800. 
To use the Atari display, and main- 
tain compatibility, EDIT uses a text 
window of 16 lines by 32 characters. A 
FORTH screen is thus divided in half — 
the left side (SIDE = Oj and the right 
side (SIDE= 1]. The ciirrent side of the 
FORTH screen is displayed on the 
video screen with a solid line around 
the text area. The current text position 
is indicated by inverse video, as in the 
normal Atari display. In addition to the 
text window, the other half of the cur- 
rent line is displayed at the bottom of 
the video screen. 

In my applications, the left side of a 
FORTH screen is used for actual 
FORTH code and the right side is 
reserved for comments. Thus, when 
viewing a FORTH screen, all the code 
on the left side (SIDE = 0) may be ex- 
amined at once, while only one com- 
ment line is displayed at a time as the 
cursor is moved from line to line. So 
far, 32 characters have been enough to 
code a logical FORTH step, and 32 
characters are usually adequate to com- 
ment that step. In addition, this inter- 
pretation of a FORTH screen en- 
courages a vertical style of FORTH 
definitions, with a comment for each 
step. Considering the low cost of 
diskettes, I prefer to spend a small 
amount of money for the comments of 
a vertical definition, rather than to 
spend a large amount of time decipher- 
ing terse, horizontal definitions, con- 
taining few step-by-step comments. 

A final pragmatic reason for select- 
ing the 32-character text window lies in 
the fig-FORTH treatment of disk 
blocks when read into memory. Con- 
secutive fig-FORTH disk blocks are not 
necessarily stored in memory con- 
secutively. Further, a disk block in 
memory must also contain disk-related 
information. Fortunately, after a disk 
block is read into memory, the starting 
address of any 64-character line may be 
retrieved by the FORTH word (LINE). 
Since the characters of each line are 
stored consecutively in memory, a 
32-character text window is easily 
manipulated. A text window not fitting 
evenly into 64 characters would have to 
be handled by overlapping from block 
to block. 

Implementation 

EDIT is implemented as a tvun-key 
application. That is, once EDIT is in- 



Llstlng 1 (continued) 



SCR » 64 

< PRIMITIVE SCREEN MANIPULATIONS) 



2 : 


CURSOR 


3 


CURSORS 


4 


POINT-CURSOR ; 


5 


SCREEN-CURSOR 


7 


CURS0R3 


B 


SWAP 40 « + 


9 


106 C3 256 « 


10 


960 - 


11 


+ DUP 


12 


C3 128 XOR 


13 


SWAP CI : 


14 




15 - 


-y 


SCR » 


65 


( 
1 

2 : 


PRIMITIVES FOR DISPLAY > 


HLINE 


3 


34 DO 


4 


TOP-BOT EMIT 


5 


LOOP ; 


6 




7 : 


LADDR 


B 


CLINE a SCR 3 (LINE) DROP 


9 


SIDE 3 IF 32 + ENDIF ; 


10 




11 : 


EADDR 


12 


CLINE 3 SCR 3 (LINE) DROP 


13 


SIDE 3 0= IF 32 + ENDIF ; 


14 




15 - 


— /■ 


SCR « 


66 


< 
1 


PRIMITIVES FOR DISPLAY ) 


ELINE 


3 


LEDQE EMIT 


4 


LADDR 32 TYPE 


5 


REDQE EMIT ; 


b 




7 1 


XLINE 


B 


LEDGE EMIT 


9 


EADDR 32 TYPE 


10 


REDGE EMIT ; 


11 




12 




13 




14 




15 - 


-> 


SCR 4t 


67 


< 
1 
2 : 


PRIMITIVES FOR DISPLAY ) 


WRITE-LINE 


3 


CLINE 3 LINEOFF 3 + 


4 


CHAROFF 3 1 - 


5 


POINT -CURSOR 


b 


ELINE ; 


7 




S : 


WRITE-EXTRA 


9 


EXTRADFF 3 LINEOFF 3 + 


10 


CHAROFF 3 1 - 


11 


POINT-CURSOR 


12 
13 
14 


XLINE ; 




15 - 


-> 


SCR *t 


68 


( 

1 


PRIMITIVES FOR DISPLAY > 


TOP 


3 


LINEOFF 3 1 - 


4 


CHAROFF 3 1 - 


5 


POINT -CURSOR 


b 


HLINE ; 


7 




B : 


BOT 


9 


LINEOFF 3 16 + 


10 


CHAROFF 3 1 - 


11 


POINT -CURSOR 


12 
13 
14 


HLINE ; 




15 - 


-> 



( Get video row and col pos ) 
( Point ATARI text cursor ) 



( Get video row and col pos ) 

< Form GR.i3 mem addr o-f-f set ) 

( Get top o-f memory addr ) 

( Backup to 1st o-f di spl ay ) 

( Farm mem addr of cursor ) 

( Bet screen display, invert ) 

( Put inverse video back ) 



( ) 

( For horizontal wi ndow span > 
( Put a bar i n each char ) 



( addr ) 

< Compute mem addr a-f 1 ine ) 
( Adjust -for le-ft side ) 

( addr > 

< Compute mem addr o-f 1 i ne ) 
( Ad just -for ri ght side ) 



( > 

( Output le-ft window edge ) 

< Type actual text line ) 

( Output r i ght wi ndow edge ) 

( > 

( Output le-ft wi ndow edge ) 

< Output text line over -flow ) 
( output right window edge ) 



( ) 

( Get vi deo line number ) 

( Poi nt to le-ft border pos ) 

( Point ATARI text cursor ) 

< Output edit line here ) 

( ) 

< Get video line number ) 

( Point to le-ft border pos ) 

( Point ATARI te:-:t cursor ) 

( Output extra line here ) 



( ) 

( Be-fore 1st line video ) 

( posi tion o-f le-ft wi ndow ) 

( Point ATAf^I text window ) 

< Output a horizontal line ) 

( > 

( A-f ter 1 ast 1 i ne vi deo ) 

< Posi tion o-f le-ft wi ndow ) 
( Point ATARI text window ) 

( Output a horizontal line ) 



48 



MICRO 



No. 57 - February 1983 



Listing 1 (continued) 

SCR * 69 

a < PRIMITIVES FOR DISPLAY > 
1 

2 : ETITLE 

3 lil CHAROFF 3 POINT-CURSOR 

4 . " Screen: " SCR ? 

5 1 CHAROFF 3 POINT-CURSOR 

6 . " Side: " SIDE ? ; 
7 



9 
llil 
11 
12 
13 
11 
15 



( ) 

< Point to 1st video line ) 
( Type the screen number ) 

( Point to 2nd video line ) 

< Type the screen number ) 



SCR tt 70 

( DISPLAY CURRENT SCREEN ,) 
1 

2 : DISPLAY 

3 ECLEAR ETITLE 

4 TOP 

5 CLINE 3 

6 16 DO , 

7 I CLINE I WRITE-LINE 

8 LOOP 

9 CLINE ' 

10 SIDE 3 IF 32 ELSE ENDIF 

1 1 CCHAR ' 

12 EOT 

13 WRITE-EXTRA 

14 CURSOR SCREEN-CURSOR ; 

15 — > 



( 



) 



( Clear video, put title > 

( Output top o+ window ) 

( Save current line on stack 

( For each line in text ) 

( 

( 

< 



Set CLINE and output it ) 
NeKt Forth text line ) 
Restore current line ) 
( Get start depending on side 
( Store as current col pos ) 
( Output bottom o+ window ) 
( Output current line ovr+low 
< Position cursor, show it ) 



SCR #71 

( CASE STATEMENT BY DR. C. E. EAKER, FORTH DIMENSIONS CV2,*t3] ) 

1 

2 : DOCASE ?COMP CSP 3 ' CSP 4 : IMMEDIATE 



6 

7 
8 
9 
10 
11 
12 
13 
14 
15 



CASE 4 7PAIRS COMPILE OVER COMPILE = COMPILE (3BRANCH 
HERE , COMPILE DROP 5 ; IMMEDIATE 

ENDCASE 5 7PAIRS COMPILE BRANCH HERE , 
SWAP 2 [COMPILE] ENDIF 4 ; IMMEDIATE 

ENDCASES 4 7PAIRS COMPILE DROP 
BEGIN SP3 CSP 3 = 0= WHILE 
2 CCOMPILEl ENDIF REPEAT 
CSP I ; IMMEDIATE 



SCR # 72 

( CURSOR MOVEMENT PRIMITIVES ) 
1 

2 : MOVE-RIGHT < ) 

Z CCHAR .3 1+ < Get/increment char pos ) 

4 SIDE 3 IF C Handle wrap around on side ) 

5 DUP 64 = IF DROP 32 ENDIF ( Over 63 goes to 32 on right ) 
ELSE 

DUP 32 = IF DROP ENDIF ( Over 31 goes to on left ) 



ENDIF 
CCHAR 



6 

7 

8 

9 
10 
U : RIGHT 

12 MOVE-RIGHT SCREEN-CURSOR 

13 : RIGHT-CURSOR 

14 SCREEN-CURSOR RIGHT ; 

15 — > 



SCR # 73 

( CURSOR MOVEMENT PRIMITIVES ) 



< Store new current char ) 

( , 

( Move and set cursor ) 

( ) 

< Restore cursor, move ) 



10 
11 
12 
13 
14 
15 



MOVE-LEFT ( ) 

CCHAR 3 1 - ( Get/decrement current pos ) 

SIDE 3 IF ( Wrap around on side ) 

DUP 31 = IF DROP 63 ENDIF ( Go to 63 on right wrap ) 
ELSE 

DUP -1 = IF DROP 31 ENDIF ( So to 31 on le-ft wrap ) 
ENDIF 

CCHAR ! ; ( Store new char pos > 



LEFT 

MOVE-LEFT SCREEN-CURSOR : 
LEFT-CURSOR 

SCREEN-CURSOR LEFT : 



< ) 

( Move and set new cursor > 

( ) 

( Restore cursor, move > 



LANGUAGES 

voked, it interprets all user keystrokes 
until the end of the edit session. In 
general, the words called by EDIT 
should not be executed from the key- 
board. Since the EDIT words manipu- 
late the screen, results of direct execu- 
tion can be confusing. EDIT is invoked 
by pushing the screen number on the 
data stack and calling EDIT. For exam- 
ple, to edit screen number 60, type: 

60 EDIT 

Listing 1 is the EDIT application occu- 
pying screens 60 through 86 on my 
EDIT source disk. The original EDIT 
text was entered with the APX fig- 
FORTH editor (27 LOAD] and rewrit- 
ten with the debugged version of EDIT. 
The basic structure of EDIT is 
straightforward. As defined on screens 
85 and 86, EDIT reads a screen into 
memory, displays the left half 
(SIDE = 0) on the video display, and 
sets a stop flag to zero (no stop). The 
main loop is executed until the stop 
flag is set to a non-zero value by one of 
the FORTH words EXIT, EABORT, 
ENEXT, or ELAST. EDIT inputs a ter- 
minal key each pass through the main 



ssssssssssssssssssessssssss 

"■"'CQ/DPU 5E[\J5Ei:.'' 

CARDBOARD 3 

An Economy Expansion Interface 
(Motherboard) 

For the VIC-20® Personal 
Computer 

The "CARDBOARD/a" is an expansion inter- 
face designed to allow the user to access more 
than one of the plug-in-type memory or utility 
cartridges now available. It will accept up to 3 
RAM or ROM cartridges at once. For example: 

• 16k RAM + 16k RAM * 3k RAM 

• 16k RAM + 8k RAM + Super Expander 

• 16k RAM + ak RAM + Vic-Mon 

• 16k RAM + 3k RAM + Programmers Aid 

• High quality T.R.W. gold plated connectors 

• This board is fused 

• 90 day free replacement warranty covering J 
everything except the fuse 

$39.95 

CARDBOARD 6 

An Expansion Interface for VIC-20® 

• Allows memory expansion up to 40K 

• Accepts up to six games 

• Includes a system reset button 

• All slots are switch selectable 

• Daisy chain several units for even more 
versatility 



$87.95 



TO ORDER: 
P.O. BOX 18765 
WICHITA, KS 67218 
(316) 684-4660 






Personal checks accepted 
(Allow 3 weeks) or 
C.O.D. (Add $2) 
Handling charge $2.00 

:-20^' is a registered trademark of Commodore 



No. 57 - February 1983 



MICRO 



49 



LANGUAGES 



loop. If the key is a special case, EDIT 
executes the corresponding special 
function. Otherwise the key is added to 
the FORTH screen and the video 
screen. CASE structure allows EDIT to 
be modified or expanded easily, yet ex- 
ecutes quickly. 

A two-key escape sequence is used 
to add special functions, which do not 
have Atari keys, to EDIT. The first 
escape character starts the execution of 
the FORTH word ESC. ESC, like EDIT, 
uses a CASE statement to allow the 
next key input to select a special func- 
tion. Different classes of special func- 
tions can be added easily to EDIT with 
this technique. 

This is one of my first APX fig- 
FORTH applications and the expert 
FORTH coder may notice how little the 
stack is used as word inputs. Old pro- 
gramming habits die hard! Even so, 
there are only four important variables 
used in EDIT. CLINE and CCHAR 
maintain the current line and current 
character position in memory and on 
the text window display. SIDE keeps 
track of whether the left side (SIDE = 0) 
or the right side (SIDE = 1) of the 
FORTH screen is displayed in the text 



SYSTEMS INTEGRATOR 



INTRODUCING: 

ZYTREX 

ZT14411 

CMOS BAUD RATE 

GENERATOR 

REPLACES MOTOROLA MC14411 



PIN /FUNCTION COMPATIBLE 

IMPROVED FREQ OUTPUT 
DRIVE (4 LSTTL LOADS) 

FULLY STATIC OPERATION 

TTL-COMPATIBLE INPUTS 

WIDE OPERATING VOLTAGE 



FREE EVALUATION SAMPLES 
FOR VOLUME USERS 

$6.20 EACH AT 1000 PCS. 



ZYTREX CORPORATION 

224 NORTH WOLFE ROAD 

SUNNYVALE, CA 94086 

(408) 733-3973 



Listing 1 (continued) 



SCR # 


74 


( 
1 


CURSOR MOVEMENT PRIMITIVES ) 


MOVE-UP 


3 


CLINE 3 1 - 15 AND 


4 


CLINE : 


5 


WRITE-EXTRA ; 


6 




7 : 


EUP 


a 


MOVE-UP 


9 


SCREEN-CURSOR ; 


10 




11 : 


UP-CURSOR 


12 


SCREEN-CURSOR 


13 


EUP ; 


14 




15 - 




SCR # 


75 


( 
1 


CURSOR MOVEMENT PRIMITIVES ) 


T . 


MOVE-DOWN 


3 


CLINE 3 1 + 15 AND 


4 


CLINE 1 


5 


WRITE-EXTRA ; 


6 




7 : 


DOWN 


a 


MOVE-DOWN 


9 


SCREEN-CURSOR ; 


10 




11 : 


DOWN-CURSOR 


12 


SCREEN-CURSOR 


13 


DOWN ; 


14 




15 - 


-> 


SCR # 


76 


( 


EDITOR PRIMITIVES ) 




RETURN 


3 


SCREEN-CURSOR 


4 


SIDE 3 IF 32 ELSE ENDIF 


5 


CCHAR 1 


6 


DOWN ; 


7 




a : 


EXIT 


9 


FLUSH 


10 


1 STOP 1 ; 


11 




12 : 


EABORT 


13 


EMPTY-BUFFERS 


14 
IS - 


1 STOP 1 ; 


SCR # 


77 


( 

1 


EDITOR PRIMITIVES ) 


ENEXT 


3 


FLUSH 


4 


SCR 3 1 + SCR 1 


5 


EREAD 


6 


DISPLAY ! 


7 




a : 


ELAST 


9 


FLUSH 


10 


SCR 3 1 - SCR ! 


11 


EREAD 


12 
1 3 


DISPLAY : 


14 




15 - 


-> 


SCR # 


78 


( 

1 
^ . 


EDITOR PRIMITIVES ) 


ADDR 


3 


CLINE 3 


4 


SCR 3 (LINE) DROP 


5 


CCHAR 3 + ; 


6 




7 : 


ADDKEY 


e 


DUP ADDR C ! 


9 


CURSOR EMIT 


10 


RIGHT ; 


11 




12 : 


CHANGE-SIDE 


13 


SIDE 3 1 XOR SIDE ! 


14 


DISPLAY ; 


15 - 


- > 



^ — ) 

( Ad.-just current line, 0-15 ) 

( Save - wraparound by AND ) 

< Add e>;tra line at bottom ) 

( ___ ) 

( Move Lip the di spl ay ) 

< Inverse video cursor pos ) 



( Restore current cursor ) 
( move Lip, new cursor ) 



( ) 

( Move down a line, 0-15 ) 

< Save new, wraparound by AND ) 
( Add extra te;:t line ) 

( ) 

( Move down a line ) 

( Set new cLtrsor video pos ) 

( ) 

< Restore vi deo cursor pos ) 

i Move down , set new crursor ) 



( ) 

( Restore cursor vi deo ) 

( Get beginning of line > 

( Set as the cLirrent char ) 

( Move down ) 

( ) 

( Force di sk output d+ update 
( Set editor stop flag ) 

( ) 

( Scratch updated buffers ) 
( Set editor stop flag ) 



( ) 

< Write out updated buffers ) 

( Ne;;t screen, no error check ) 
( Read the FORTH screen ) 

i Display, and edit ) 

/ ) 

'. Wri te out updated buffers ) 

'. Last screen, no error check ) 

< Read the FORTH screen ) 
( Display, and edit ) 



( ) 

( Get the current line number ) 
( Get the memory address ) 
( Add the current char pos ) 

( ) 

( Store a copy in memory text ) 
( Output char to vi deo screen ) 
< Move right for next ) 

( .) 

( Flip LSB: fel, 1 legal values ) 
( Display, set CCHAR to start ) 



50 



MICRO 



No. 57 - February 1983 



Listing 1 (continued) 




SCR # 


79 




( 
1 

2 : 


EDITOR PRIMITIVES ) 




INSERT-CHAR 


( end-o-f-1 ine ) 


3 


ADDR SWAP CCHAR 3 - 


( Current addr, chars to move ) 


4 


SWAP OVER + SWAP 


( End of line, tt to move > 


5 


-DIJP IF 


( If any chars to move right ) 


6 


DO 


( For each char to move over ) 


7 


DUP 1 - C3 OVER CI 


( Store previous toward end ) 


8 


1 - 


( Next one closer to blank ) 


9 


LOOP 


( Until space opened in line ) 


10 


ENDIF 




11 


BL SWAP C! ; 


< Fill for space ) 


12 : 


INSERT 


( , 


13 


SIDE 3 IF 63 ELSE 31 ENDIF 


( Set end of line limit ) 


14 


INSERT-CHAR WRITE-LINE 


( Insert blank, output line > 


15 


CURSOR SCREEN-CURSOR ; — 5 


C Set the cursor ) 


SCR # 


80 




( 
1 


EDITOR PRIMITIVES ) 




DELETE-CHAR 


( end-of-line > 


3 


ADDR SWAP CCHAR 2 - 


( Get addr, # chars to move ) 


4 


-DUP IF 


( If any chars to move left ) 


5 


DO 


i For each moving character ) 


6 


DUP 1 + C3 OVER C! 


( Move right to left ) 


7 


1 + 


( Next address in line ) 


e 


LOOP 




9 


ENDIF 




10 


BL SWAP C ' ! 


( Insert blank at end of line ) 


11 






12 : 


DELETE 


( ) 


13 


SIDE 3 IF 63 ELSE 31 ENDIF 


< Determine end char of line ) 


14 


DELETE-CHAR WRITE-LINE 


( Delete current char, outut ) 


15 


CURSOR SCREEN-CURSOR ; — > 


( Reset cursor ) 


SCR « 


81 




( 

1 
2 : 


EDITOR PRIMITIVES ) 




L-A 


( addr ) 


3 
4 
S : 


SCR S (LINE) DROP ; 


( Get the address of start ) 


DELETE-L 


( ) 


6 


CLINE S> L-A SAV-BUF 64 CMOVE 


( Save current in SAV-BUF ) 


7 


15 CLINE 3 - IF 


( If not the last line > 


8 


15 CLINE 3 DO 


( For each line above current ) 


9 


I 1+ L-A I L-A 64 CMOVE 


( Move line one toward line«0 ) 


10 


LOOP 




11 


ENDIF 




12 
13 
14 : 


15 L-A 64 BLANKS ; 


( Blank line « 15 ) 


DELETE-LINE 


( ) 


15 


DELETE-L DISPLAY ; — > 


( Delete and display ) 


SCR # 


82 




( 

1 
2 : 


EDITOR PRIMITIVES ) 




INSERT-L 


) 


3 


15 CLINE 3 - IF 


If not the last line ) 


4 


CLINE 3 15 DO 


Start at the end of screen ) 


5 


I 1 - L-A I L-A 64 CMOVE 


Shuffle lines to end ) 


6 


-1 +LOOP 


Move toward current ) 


7 


ENDIF 




8 


CLINE 3 L-ft 64 BLANKS ; 


Blank current line ) 


9 : 


INSERT-LINE 


( ) 


10 


INSERT-L DISPLAY ; 


Insert blank line, display ) 


11 






12 : 


PUT-LINE 


( ) 


13 


INSERT-L 


< Insert a blank line ) 


14 


SAV-BUF CLINE 3 L-A 64 CMOVE 


( Restore deleted line ) 


15 


DISPLAY ; — > 


< Display ) 


SCR « 


83 




( 

1 


EDITOR PRIMITIVES ) 




TAB 


( ) 


3 


2 DO 


( Tab spaces only 2 for me ) 


4 


RIGHT-CURSOR 


< Simulate moving cursor ) 


5 
6 
7 : 


LOOP ; 




DEL 


( > 


B 


LEFT-CURSOR BL DUP ADDR C! 


( Move left and blank mem ) 


9 


CURSOR EMIT SCREEN-CURSOR ; 


( Echo to screen ) 


10 






11 : 


CLEAB-SCR 


( ) 


12 


16 DO 


( For all 15 lines in screen ) 


13 


I L-A 64 BLANKS 


< Blank memory text ) 


14 


LOOP 




15 


DISPLAY ; — > 


( Display results ) 



^^M LANGUAGES 

window. Finally, STOP is the exit flag 
used in the main loop (0 = continue, 
l = stop). 

EDIT implements the following 
special function keys of the Atari 800: 



Command 

[delete] 

CTRL/ [delete] 



SHFT/ [delete] 
CTRL/ [insert] 

SHFT/ [insert] 



CTRL/ [clear] 

SHFT/[clearl 

CTRL/ [right] 

CTRL/Jleftj 

CTRL/[up] 

CTRL/ [down] 

RETURN 

TAB 



Function 

Delete character be- 
fore cursor 
Delete current char- 
acter, shrink line in 
text window 
Delete current line, 
move rest up one line 
Insert space at cur- 
sor, expand line in 
text window 
Insert new line at 
cursor, line 15 is lost 
from the display but 
saved in a buffer for 
the "ESC P" 
command 
Clear the text 
window 
Clear the text 
window 

Move cursor right 
within text window 
Move cursor left 
within text window 
Move cursor up 
within text window 
Move cursor down 
within text window 
Advance to the first 
character of the next 
line 

Move two characters 
right 



Only the text window is affected by 
these special function keys. 

The following functions are imple- 
mented as two-key escape sequences: 

Command Function 

ESC E Exit the editor, writing the 

edited screen to disk 
ESC A Abort the edit session, no 

change to the disk screen 
ESC N Save the current screen, 

edit the next screen 
EXC L Save the current screen, 

edit the last screen 
ESC S Switch FORTH screen 

sides in the text window 
ESC P Put down (insert) the last 

line deleted 

The escape sequence method was 
chosen in order to leave the normal and 



No. 57 - February 1983 



MICRO 



51 



L\;co Computer Marketing & Consultants 



TO ORDER 

CALL US 



TOLL FREE 800-233-8760 

In PA 1-717-398-4079 



FEBRUARY 

ATARI 

SPECIALS 



810 Disk Drive ... $429.00 
400 32K RAM... $ CALLS 

NEW ATARI 
COMPUTER... $ CALLS 



800 48K... $499.00 



ATARI 

^B A Warner Communicattons Company 



ATARI HARDWARE 



410 CASSETTE RECORDER ...,$ 75.00 

825 PRINTER $585.00 

830 PHONE MODEM $149.00 

850 INTERFACE $1 64.00 

PACKAGES 

CX481 ENTERTAINER $ 69.00 

CX482 EDUCATOR $1 25.00 

CX483 PROGRAMMER $ 49.00 

CX494 COMMUNICATOR $325.00 

SOFTWARE 

CXL4012 MISSILE COMMAND ... $28.75 

CXL401 3 ASTEROID $28.75 

CXL4020 CENTIPEDE $32.75 

CXL4022 PACMAN $32.75 

CXL4011 STAR RAIDER $34.75 

CXL4004 BASKETBALL $26.75 

CXL4006 SUPER BREAKOUT ....$28.75 

CXL4008 SPACE INVADER $28.75 

CX81 30 CAVERNS OF MARS $31.75 

CX41 08 HANGMAN $12.75 

CX4102 KINGDOM $12.75 

CX4112STATES4 

CAPITALS $1 2.75 

CX41 14 EUROPEAN 

COUNTRIES $12.75 

CX41 09 GRAPHIT $1 6.75 

CX4121 ENERGY CZAR $12.75 

CX41 23 SCRAM $19.75 

CX4101 PROGRAMMING I $19.75 

CX4106 PROGRAMMING II $22.75 

CX4117 PROGRAMMING III $22.75 

CXL401 5 TELELINK $21.75 

CX41 1 9 FRENCH $39.75 

CX41 1 8 GERMAN $39.75 

CX41 20 SPANISH $39.75 

CXL4O07 MUSIC COMPOSER.... $33. 75 

CXL4002 ATARI BASIC $45.75 

CX81 26 MICROSOFT 

BASIC $65.75 

CXL4003 ASSEMBLER 

EDITOR $45.75 

CX8126 MACRO 

ASSEMBLER $69.75 

CXL401 8 PILOT HOME $65.75 

CX405 PILOT EDUCATOR $99.75 

CX415 HOME FILING 

MANAGER $41 .75 

CX41 4 BOOKKEEPER $119.75 



NEW RELEASES 

CHOP LIFTER $27.75 

APPLE PANIC $23.75 

PREPPIE $19.95 

THIRD PARTY SOFTWARE 

EASTERN FRONT 1941 $25.50 

OUTLAW/HOWITZER $15.50 

WIZARD ot WAR $31 .00 

GORF $31 .00 

FROGGER $26.00 

CHOP LIFTER $27.75 

APPLE PANIC $23.75 

PREPPIE $1 9.95 

STAR WARRIOR $28.00 

CRUSH, CRUMBLE.&CHOMP $23.00 

SHOOTING GALLERY $19.95 

VIDEO MATH FLASH $1 2.00 

MY FIRST ALPHABET $25.50 

BAHA BUGGIES $24.95 

TE^IPLE of ASPHAI $27.95 

UPPER REACHES 

of ASPHAI $1 5.00 

TRACK ATTACK $23.00 

STAR BLAZER $25.00 

LABYRINTH $23.00 

SEA FOX $23.00 

POOL 1.5 $26.95 

SPEEDWAY BLAST (ROM) $29.95 

JAWBREAKER $22.95 

THRESHOLD $29.95 

MOONBASE 10 $23.95 

PROTECTOR $24.95 

NAUTILUS $24.95 

SLIME $24.95 

SUBMARINE 

COMMANDER (ROM) $36.95 

JUMBO JET 

PILOT (ROM) $36.95 

SOCCER (ROM) $36.95 

KICKBACK (football ROM) $36.95 



PRINTERS 

Okldata a2A $470.00 

Okidat* a3A $71 9.00 

OKidat* 84 $1069.00 

Citoh CALL 

Prowrltar I $499.00 

Prowritar II CALL 

SMITH CORONA TP-1 . $625.00 

NEC CALL 

(Intaffacing Avallablal 



BUSINESS SOFTWARE 

ATARI WORD PROCESSING . . . 

LETTER PERFECT (ROM) 

LETTER PERFECT (disc) 

TEXTWIZZARD 

DATA PERFECT 

VISICALC 

DATASAM/65 


.$109.00 
.$149.00 
.$129.00 
.$ 89.00 
.$ 75.00 
.$169.00 
^12^^^ 


JOYSTICKS 

ATARI CX-40 


..$18.00 


LESTICK 

WICO COMMAND CONTROL . . 
WICO RED BALL 


..$34.00 
..$23.75 
..$26.75 


WICO TRACK BALL 


.$54 75 


STICK STAND 


..$ 6.75 



COMPUTER COVERS 

800 


...$6.99 


400 


...$6.99 


410 


...$6.99 


. 810 


...$6.99 



POLICY 



I In-Stock items shipped within 24 hours of order. Personal 
I checks require four weeks clearance before shipping. No 
I deposit for COD orders. PA residentsadd sales tax. All products 
I subject to availability and price change. Advertised prices 
I show 4% discount offered for cash. Add 4% for Mastercard and 
Visa. 



PERCOM 

SI NGLE DRIVE (SD) $399.00 

SINGLE DRIVE (DD) $549.00 

DUAL DRIVE (DD) $869.00 

DUAL HEAD (DD) $669.00 

ro ORDER 
CALL TOLL FREE 

1800-233-8760 



|ln PA 1-717-398-4079 
or send order to 

Lyco Computer 
P.O. Box 5088 
I Jersey Shore, PA 1 7740 1 



52 



MICRO 



No. 57 - February 1983 



LANGUAGES 



Listing 1 (continued) 



SCR # 84 

( ESCAPE KEY PROCESSOR > 



KEY DOCASE 



( Do case on the next key ) 



6 

7 

S 

9 

10 

11 

12 

13 

14 

15 

SCR 

1 



a 

9 
10 
1 1 
12 
13 
14 
15 



S3 CASE CHANSE-SIDE ENDCASE < ESC S 

78 CASE ENEXT 

76 CASE ELAST 

69 CASE EXIT 

65 CASE EABQRT 

30 CASE PUT-LINE 



ENDCASE ( ESC N 

ENDCASE ( ESC L 

ENDCASE ( ESC E 

ENDCASE ( ESC A 

ENDCASE ( ESC P 



change video side ) 
edit next screen ) 
edit last screen ) 
exit editor ) 
abort edit session ) 
put down deleted line 



BEEP ENDCASES 



i else signal Vtey error ) 



# 85 

•; SCREEN EDITOR DEFINITION ) 

: EDIT 
SCR ! 

EREAD DISPLAY 
STOP : 

BEGIN 
KEY DOCASE 

28 CASE UP-CURSOR ENDCASE 

29 CASE DOWN-CURSOR ENDCASE 
31 CASE RIGHT-CURSOR ENDCASE 

30 CASE LEFT-CURSOR ENDCASE 
155 CASE RETURN ENDCASE 



( screen# ) 

( Save EDIT screen number ) 
( Read and display screen ) 
( Clear stop -flag to -false ) 

( Begin editing ) 

( Get a key and process ) 

ATARI up arrow ) 

ATARI down arrow ) 

ATARI right arrow ) 

ATARI le-ft arrow ) 

ATARI return key ) 



SCR # 06 

( SCREEN EDITOR DEFINITION ) 
1 

2 255 CASE INSERT ENDCASE 

3 254 CASE DELETE ENDCASE 

4 157 CASE INSERT-LINE ENDCASE 

5 156 CASE DELETE-LINE ENDCASE 

6 126 CASE DEL ENDCASE 

7 127 CASE TAB ENDCASE 

8 125 CASE CLEAR-SCR ENDCASE 
9' 27 CASE ESC ENDCASE 

DUP ADDKEY ENDCASES 
STOP 3 
UNTIL 

XGR ; 



( ATARI 
( ATARI 
( ATARI 
( ATARI 
( ATARI 
< ATARI 



CTRL/ INSERT key ) 
CTRL /DELETE key ) 



) 



SHIFT/ INSERT key 

SHIFT/DELETE key ) 

DELETE key ) 

TAB key ) 
( ATARI CTRL/CLEAR key ) 
( Enter escape key -function ) 
'. else addkey to text ) 
( Check i-f stop -flag set ) 
( Edit until stop is true ) 

< Clear screen, goto FORTH ) 



control keys (graphics) available for 
FO_RTH screen text. 

As a final note, most versions of fig- 
FORTH do not include a CASE state- 
ment. However, unlike languages such 
as BASIC or FORTRAN, FORTH may 
be extended to include new control 
structures. EDIT uses a set of CASE 
words defined by Dr. C.E. Eaker, 
orginally written for a 6800 FORTH 
system {FORTH Dimension, Volume 
II, Number 3, pp. 37-40). Only the 
word names were changed when using 
this CASE statement. The actual 
definitions were compiled and ex- 
ecuted the first time. Applications 
written in high-level FORTH (no code 
words) can usually be transported be- 
tween FORTH systems, regardless of 
the processor type. 



Conclusion 

EDIT is my first large application 
with the APX fig-FORTH implementa- 
tion. While EDIT probably is not as 
efficient as possible, it was written and 
debugged in less than 15 hours. Any 
language that allows a large application 
to be rapidly and logically imple- 
mented during the learning process cer- 
tainly deserves attention! Many well- 
designed concepts are at work in 
FORTH and all programmers should 
consider FORTH as an alternative to 
BASIC. 



The author may be contacted at 7659 West 
Fremont Ave., Littleton, CO 80123. 



iMCftO 




HYPERCARTRIDGE® 
for ATARI® 400/800 

16K 




$39 

w/o EPROMs/ROMs 

FOR SOFTWARE DEVELOPERS 
AND HOBBYISTS! 

• extend memory of 16K RAM 
and 32K RAM computers 

• create 16K cartridges easily 
with an EPROM programmer 

• combine ATARI® BASIC ROMs 
with your own subroutines 
on ROM/EPROM 

• eliminate need for disk drive 
and extra RAM for lengthy 
programs 



CONFIGURATIONS: 

#1 Any combination of 4 

2532 EPROMs/2332 

ROMs 
#2 Two ATARI ROMs 

and two 2532's (or 

2332's) 
SPECIFY WITH ORDER 



Also order: 

2532 4K EPROMs $7.50 each 

with cartridge order only 



*************************** 



® 



CHAMELEON COMPUTING 

Dept. of Physics & Astronomy 

Box 119-M 

Dickinson College 

Carlisle, PA 17013 

(717) 245-1717 

*************************** 

Please add: 

$1.50 shipping/handling 

PA residents add 6% sales tax 

CHECK, MC, VISA 

Quantity discounts available 



No. 57 - February 1983 



MICRO 



53 



LANGUAGES 



APPLE Pascal 
Hi-Res Screen Dump 



by Robert D. Walker 



A Pascal procedure to dump the 
high-resolution graphics screen 
to your printer. 



SCREENDUMP 

requires: 

Pascal 

Epson with Graftrax 



Many machine-language subroutines 
have been written to dump the Apple 
high-resolution graphics to the Epson 
MX-80 printer. I have not found, how- 
ever, any subroutine specifically written 
for Apple Pascal. If you own an Epson 
MX-80 (with Graftrax) and want a hard 
copy of Turtlegraphics, the following 
Pascal procedure should prove handy. 

The procedure in listing 1 takes ad- 
vantage of Pascal's ability to declare 
variant records. The type WIRES 
associates eight boolean variables with 
eight bits in a byte. In fact, these eight 
boolean variables occupy the same 
memory location as the byte. Each 
boolean variable represents one wire on 
the printhead. If the boolean variable is 
true, the printing wire is fired, other- 
wise it is not. 

I encountered one problem during 
the testing of this procedure. The 
intrinsic WRITE procedure does not 
allow all character codes to be passed to 
the printer. This problem is cir- 
cumvented by using the low-level pro- 
cedure UNITWRITE (see pp. 41-42 of 
the Apple Pascal Language Reference 
Manual] . 



The SCREENDUMP procedure has 
the following form: SCREENDUMP 
(LEFT, RIGHT, BOTTOM, TOP, 
LMARGIN) 

LEFT = left X position to be printed 
RIGHT = right X position to be printed 
BOTTOM = bottom Y position to be 

printed 
TOP = top Y position to be printed 
LMARGIN = number of spaces in left 

margin 
[Note: both Y values are rounded to the 
next lower integer evenly divisible by 
eight.] 

Using SCREENDUMP is simple. I 
have included a sample printout and a 
short program that demonstrates its 
use. The procedure is easy to use and 



there is no need for error checking. It is 
the programmer's responsibility to en- 
sure that all parameters are within the 
proper range. 

I have used this procedure in many 
programs involving Turtlegraphics. Be- 
cause of the popularity of the Apple II 
and the Epson MX-80, this procedure 
should find a place in many subroutine 
libraries. 



You may contact the author at 2850 Delk 
Rd., Apt. 2B, Marietta, GA 30067. 



Figure 1: Sample Ouptut From SCREENDUMP 




54 



MICRO 



No. 57 - February 1983 



LANGUAGES 



Listing 1: SCREENDUMP 

PROGRAn SAnPLEUSEOFSCREENDUnP; (t SAHPLE PROGRAH USING SCREENDUHP I) 
USES TURTLEGRAPHICS; 
VAR DISTINC: INTEGER; 



PROCEDURE SCREENDUNPILEFT, RIGHT, BOTTGH, TOP, LNARGIN: INTEGER!; 
(titttttlllttlltttttlllltllttltlllllltttttllllttllltllttttllltllttlltllt) 

(It It) 

(tt THIS PROCEDURE DUI1PS THE APPLE HIRES SCREEN TO THE EPSON m-it III 
(If PRINTER EQUIPPED NITH GRAFTRAX. TURTLEGRAPHICS PROCEDURES AND tl) 
(It FUNCTIONS ARE USED. It) 

(tl II) 

(tt R. NALKER 7/82 tl) 

(It BARIETTA, GA ttl 

(It It) 

(tttttttttltlttttlltttlttttttttttttttltltttttlttllltttttttlttltltttltltl) 

TYPE BVTE=8..255; 

(t USE VARIANT RECORD TO ASSOCIATE PRINTING HIRES NITH iilE «) 
mRES=PACKED RECORD CASE BOOLEAN OF 

TRUE: (BO: PACKED ARRAY [0.. 71 OF BOOLEAN); 
FALSE; (BY: BYTE) 
END; 

VAR I,1(,YC0ARSE,YFINE: INTEGER; 

BITIHAGE; PACKED ARRAYI8. .288] OF BYTE; 
PRINTCODE; PACKED ARRAY[1..4] OF BYTE; 
N: yiRES; 

BEGIN (I SCREENDUHP t) 

il SET LINE SPACING TO 24/214" t) 

PRINTCODE! 1];=27; PRINTC0DE[2h=51; PRINTC0DE[3h=24; 

UNITNRITE(4,PRINTC0DEtl],3,«,12); 

(I PRINT SCREEN I) 

FOR YCOARSE:= (TOP DIV B) DONNTO (BOTTOH DIV 8) DO 

BEGIN 

(t HAKE LEFT MARGIN I) 

PRINTC0DE[1]:=32; 

FOR I:=l TO LBARGIN DO UNITNRITE(4,PRINTCOOE[1],1,0, 12) ; 

(t ASSEHBLE ONE LINE OF BIT IHAGES ti 
FOR ](;=LEFT TO RIGHT DO 
BEGIN 
FOR YFINE;=8 TO 7 DO N.BQ[YFINE]:=SCREENBIT(](,YCOARSEIB+YFINE); 
BITIHAGE[1I]:=H.BY 
END; 

(t TELL PRINTER HON HANY DOTS IN LINE t) 
PRINTCODE! 11: =27; PRINTC0DEI2l!=75; 
PRINTC0DEI31:=(RIGHT-LEFTtl) HOD 254; 
PRINTC0DEC41:=(RI6HT-LEFTtl) DIV 254; 
UNIT«RITE(4,PRINTC0DE[11,4,8,12); 

il SEND ONE LINE OF BIT II1A6ES TO PRINTER I) 
BITII1AGE[RIGHTtl]: = l«; (t LINEFEED t) 
UNITHRITE(4,BITinA6E[LEFTl,(RlGHT-LEFTt2),«,12) 
END; 

(t RESET PRINTER t) 
PRINTC0DEn]:=27; PRINTC0DEI2]:=44; 
UNITHRITE(4,PRINTC0DE[11,2,8,121 

END; (t SCREENDUHP t) 



Listing 1: SCREENDUMP (continued) 



BEGIN (I HAIN PROGRAH I) 

(t DRAN PICTURE t) 

INITTURTLE; 

PENCOLOR(HHITE); 

DISTINC:=1; 

REPEAT 

nOVE(DISTINC); 

TURN(91); 

DISTINC:=DISTINCtl 
UNTIL DISTINC=300; 
VIEKP0RT(74,2«3,14,32I; 
FILLSCREENIBLACK); 
PENCOLOR(NONE); 
nOVETO(B4,20); 
HSTRINSC SAHPLE SCREENDUHP'); 

(t CALL SCREENDUHP II 
SCREEHDUHP(»,279,iJ,191,17) 

END. 



/MCftO 



YOUR OWN 



^Ko\o 






zl^'\=: 



; SUPPLY 

k.on,'^ For Lab or 
1 Original Equipment 

t 30kH/ swvitching frequency • Four Models satisfy most applica 
? service • f ach side AC line fuse protected • 7"ele-Ta(e LED "Pwr 
e separate voltage outputs •Metal enclosure provrdes physical and 
irjmental use or permanent power source "Soft start feature pro- 



iMiiJ i iiiwi i Mi i J i pjmiii i ijjffl i .ijriiiH.w w 



r source tor a variety of uses and applications • 48 hour burn-m assures 
MTBF of 3% years, reasonably priced at S1.90/watt»FuH one year guarwjtee»2-toneano- 
dizad case • Custom volt/current outputs on sfieciat ordi»- • Input surg^ faatwxioa^AAitt^- 



SPKCIFICATIOms' Input- 90-13aVAC 47^440Hz • Ouaf AC Input Fuses • Line 
Regulation ±0 t% Max far 10% input change • Load RuguFation +0 2% Max on #1 Out 
put • Ripple Nniv Tyu 1% PP Max • Qwpr VQlrage RrntecMnn ■ Revere Po'.ii'.V" Procecticn 
• Compan, only 7%" x 4" x 2%"*Fast load transient response's volt adj. ±10%«OC Out- 
put: 42 Watts continuous •70% Efficiency 

SCHOOLS- LABS: QUANTITY PRICING ON REQUEST 



FEATURES: Effi 



Lcom 



Inc 1545 Osgood St. Uoit 1 1H. No. Andovor. MA 01845 



Nima (PIflaa print)_ 

Addrati 

City 



Qty. 



PS-4 



Output #1 



5V-3A 



Output #2 



+24V-0.6A 



-24V-0.6A 



Information on other switcher models 



ORDER INFORMATION 



Order First Unit- 
Second Unit- 



$99.50 
$79.60 



NC 



OFFER EXPIRES Mirch 31, 1963 

Sub. Total 

Mass. res add 5% Tax 

Shipping il Handling 
TOTAL 



a 50 



Charge to; n MasterCard n Visa n American Express D Check/Money Order 

Card # Exp. Date 

Signature 

PHONE ORDERS: CALL (617)682 6936 FOR PROMPT SERVrCE 



No. 57 - February 1983 



MICRO 



55 




64K Ram 

780 KB Disk Storage 

Word Processing, Ultracalc CP/M 

C-Basic Software 

Smith Corona TP 1 

Letter Quality Printer 

ssaas.aa 



Retail Value 



. $4895.00 



EAGLE 1600. ..CALL 




TELEVIOEO TERMINALS 

910 $579.00 

91 2C $699.00 

920C $749.00 

925C $749,00 

950 $950.00 

TELEVIOEO COMPUTERS 

800A $1319.00 

802 $2649.00 

802H $4695.00 

806 $5495.00 

816 $9495.00 

803 CALL 

1603 CALL 



MONITORS 

AMOEK 

100 B4W $74.95 

300G $1 69.00 

300A $179.00 

Color I $339.00 

Color II $699.00 

Color MA $799.00 

Color III $399.00 

Color IV CALL 

BMC 

12" Grean $79.99 

1 3" Colot 1 401 (Mid Res.) .... $369.00 
9191U 13" $329.00 

ZENITH 

ZVM 121 $99.00 

SHARP 
Sharp 1 3" Color TV $275.00 

PANASONIC 

TR-120MIP(HighRes.Green)... $159.00 
CT- 1 60 Dual Mode Color $299.00 



HEWLETT 
PACKARD 



m 



41 cv 




HP41C $149.00 

HP IOC $69.00 

HP lie $79.00 

HP 12C $114.00 

HP 15C $109.00 

NEW 16C $114.00 

PERIPHERALS 

HP41 Card Reader $144.00 

HPIL Module $99.00 

HPIL Cassette $449.00 

HPIL Printer $41 9.00 

Quad Memory Module $64.00 

Time Module $64.00 

Extended Function Module .... $64.00 



SEC 

COMPUTERS 

8001 A $729.00 

8031 $729.00 

8012 $549.00 

PRINTERS 

8023 $499.00 

7710/7730 $2399.00 

3510/3530 $1599.00 

MONITORS 

JB-1260 $129.00 

JB-1201 $159.00 

JC-1201 $319.00 

JC-1203 $729.00 



TIMEX SINCLAIR 



S89.99 




PC-IBOO 

POCKET 

COMPUTER 



XBSS^t 



1 6K Memory Module $44.95 

Vu-Calc $17.95 

Super Math $1 2.95 

Check Book Manager $13.95 

The Organizer $14.96 

The Budgeter $13.95 

Stock Option $1 4.95 

Loan & Mortgage Amortizer. . . . $12.95 





CE 1 50 Printer, Plotter and 
Cass. Interface Unit. . . $1 72.00 
CE 1 52 Cass. Recorder. . . $69.00 
CE 155 8KRam 
Expansion Module $94.00 



HP9B5 31969 

HP 125 $1999.00 

HP85 16K Memory Module ...$169.00 

5V." Dual Floppy Disk $1 799.00 

Hard Disk w/Floppy $4349.00 

Hard Disk $3549.00 

"Sweet Lips" Printer $1219.00 

80 Column Printer $649.00 




NEC 

3BBa PRINTER. . . seosa 

PERCOM ORIVES 

5'A" 1 60K Disk Drive $249.00 

5'A " 320K Disk Drive $299.00 

AMOEK 

31 OA Amt>er Monitor $1 79.00 

310G $179.00 

Amdisk (3'/." Drive) $729.00 

OXY Plotter $759.00 

Color II $699.00 

SaFT\A/ARE 

I.US. Easywriter M $249.00 

I.U.S. Easyspeller $1 29.00 

Peach Package (GL/AP/AR) . . . $41 9.00 

PROFESSIONAL 
SaFT\A/ARE 

IBM/PC Word Processing $319.00 



PRINTERS 

SMITH CORONA 

TP 1 $599.00 

C. ITOH (TEC] 

SlarwrilectF10-40CPS) $1 399.00 

PrintmastectF10-55CPS| .... $1749.00 

Prowriter 80 Col.(Parallel| $499.00 

Prowriter 80 Col.(Serlal) $629.00 

Prowriter 2 {132 Col.) $799.00 

OKIOATA 

82A $429.00 

83A $659.00 

84 (Parallel) $1079.00 

84 (Serial) $1 199.00 

lOB 

MicroPrism $649.00 

132 (Fully Configured) $1599.00 

80 (Fully Configured) Jl 399.00 

Call for otfier configurations. 

STAR 

Gemini 10 $379.00 

OAISYWRITER 

Letter Quality 1 049.00 

DIABLO 

620 $1179.00 

630 $1849.00 



MODEMS 

HAYEB 

Smart $239.00 

Smart 1 200 (1 200 Baud) $549.00 

Chronograptl $1 99.00 

Micromodem II (with Term) . . , $309.00 
Micromodem 1 00 $309.00 

NOVATION 

Cat $144.(X) 

D-Cat $159.00 

212 Auto Cat $589.00 

Apple Cat II $279.00 

212 Apple Cat II $609.00 

CALL for Price and Availability on 

New NOVATION Cat 103, 103/212 

and J<;at. 

ANCHOR 

Mar* I (RS-232) $79.00 

Mark II (Atari) 79.00 

Mark III (TI-99) 109.00 

Mar* IV (CBM/PET) $1 25.00 

Mar* V (OSBORNE) $95.00 

Mark VI (IBM-PC) $1 79.00 

Mark VII (Auto Answer Call) ... $ 1 1 9.00 

TRS -80 Color Computer $99.00 

9 Volt Power Supply $9.00 



^^ commodore 

8032 $1039.00 

CBM 64 CALL 

4032 $749.00 

8096 Upgrade Kit $369.00 

Super Pet $1 499.00 

2031 $469.00 

8250 DbLSided Disk Drive . . . $ 1 899.00 
D9060 5 Meg. Hard Disk. . . $2399.00 
D9060 7.5 Meg. Hard Disk . . $2699.00 

8050 $1299.00 

4040 $969.00 

8300 (Letter Quality) $ 1 549.00 

8023 $599.00 

4022 $399.00 

NewZ-Ram,AddsCP/M«,64K. . . $549.00 

Ttie Manager $209.00 

Magis CALL 

Word Pro 5 Plus $319.00 

Word Pro 4 Plus $299.00 

Word Pro 3 Plus $1 99.00 

The Administrator $379.00 

Info Pro Plus $219.00 

Power $79.00 

CBM 8032 Oust Cover $14.99 

CBM 8050/4040 Dust Cover. . $10.99 



computser mail order east 



IN PA. CALL (717]3a7-a878, 477 E.THIRO BT., WILLIAMBPORT, PA. 17701 

In stock items shipped same day you call. No risk, no deposit on C.O.D. orders. Pre-paid orders receive tree shipping within the continental United States with no waiting period for 
certified checks or money orders. Add 3% (minimum $3.00) shipping and handling on all C.O.D. and Credit Card ordera NV and PA residents add sales tax. All items sutjject to 
availability and price change, motbi We stock manufacturer's and third party software for most all computers on the market! CALL TODAY FOR OUR NEW CATALOGUE. 



F 



FRANKLIN 




ACE 1000 

ACE 10 with Controller Card 
ACE Writer Word Processor 

CALL... 
FOR SYSTEM PRICE! 

ACE 1 200 CALL 



VISICORP 

for Apple, IBM & Franklin 

Visidex $189.00 

Visifile $1 89.00 

Visiplot $1 59.00 

Visiterm $89.00 

Visitrend/Plot $229.00 

VisiSchedule $229.00 

Desktop Plan $ 1 89.00 

Visicalc (Apple II. Atari, CBM, IBM)..$1 79.00 
Visicorp prices for IBM may vary slightly. 

CONTINENTAL 

Home Accnt. (Apple/Franklin). . . $59.00 

Home Accountant (IBM) $119.00 

1st Class Mail (Apple/Franklin) . . . $59.00 

aiRius 

Free Fall $24.00 

Beer Run $24.00 

Snake Byte $24.00 

Space Eggs $24.00 

Sneakers $24.00 

Bandits $28.00 

BROOERBUND 

Apple Panic $23.00 

David's Magic $27.00 

Star Blazer $25.00 

Arcade Mact*.ine $34.00 

Choplifter $27.00 

Serpentine $27.00 

INFOCOM 

Deadline $35.00 

Star Cross $29.00 

Zork I $29.00 

Zork II or III $29.00 

MPC 

Bubdisk{126K Ram) $719.00 

AXLON 

Ram Disk (Apple/Franklin) CALL 



Call for Price on 
VIC 64 

Periptierals and Software. 
pnaFBsaiaNAi. aaFTWAna 

Wort Processing for VIC 64 ... . $79.95 




OISK DRIVES 
FOR ATARI 

AT 88-S1... $399.00 
AT 88-A1.... $289.00 
RFD40-S1... $539.00 
RFD40-A1... $329.00 
RFD 40-82. ..$869.00 
RFD44-S1... $659.00 
RFD 44-82. ..$999.00 



RANA DISK DRIVES 

Call for price and availability on tfie 
new Rana Disk Drives tor The Apple 
and Franklin Computer Systems. 



u-sa 




ICRO-SCI 

OIBK DRIVES FOR 
APPLE & FRANKLIN 

A2 $299.00 

A40 $349.00 

A70 $459.00 

C2 Controller $79.00 

C47 Controller $89.00 



FLOPPY DISKS 

MAXELL 

MD I (Box of 10) $32.00 

MD II (Box of 1 0) $44.00 

FDMS") $40.00 

FD II (8" DD) $50.00 

VERBATUM 

SV. " SS DD $26.00 

5V. " DS DD $36.00 

ELEPHANT 

5y."SSSD $19.99 



VIC so 
$179. 




VIC 20 Dust Cover $9.99 

VIC 1 530 Datassette $69.00 

VIC 1540 Disk Drive $339.00 

VIC 1541 (64K Disk Drive) CALL 

VIC 1S2S Graphic Printer $339.00 

VIC 1210 3K Mem. Exp $32.00 

VIC llloaKMem. Exp $53.00 

VIC 1111 16KMem. Exp $94.00 

VIC 101 1 RS232CTemi Interface. .. $4300 
VIC 1 1 1 2 IEEE-4a8 Interlace . . . $86.00 

VIC 1 2 1 1 Super Expander $53.00 

VIC Mother Board $99.00 



Jt HOMECOMPUTERS 

ATARr 




400 

16K 9199 

aSK SS74<= 

4aK sasa*^ 

*Non-Atari Ram 

41 Recorder $74.00 

81 Disk Drive $429.00 

822 Printer $269.00 

825 Printer $589.00 

830 Modem $159.00 

820 Printer $259.00 

850 Interlace $169.00 

CX40 Joy Sticks (pair) $1 8.00 

CX853 Atari 1 6K Ram $77.95 




New low price effective January 1 . 1 983. 

Call for Price and 
Availability of the NEW 

B4K ATARI 1800 

AxlonRamdisk(128K) $429.95 

Inlec 48K Board $159.00 

Inlec 32K Board $74.00 

One Year Extended Warranty $70.00 
CX481 Entertainer Package . . . $69.00 
CX482 Educator Package $130.00 
CX483 Programmer Package . . . $54.00 
CX484Commun«ator Package . $344.00 



SOFT>WARE 
ATARI 

Pac-Man $33.00 

Centipede $33.00 

Caverns of Mars $32.00 

Asteroids $29.00 

Missile Command $29.00 

Star Raiders. $35.00 

Galaxian $33.00 

Defender $33.00 

ON-LINE 

Jawbreaker $27.00 

Softporn $27.00 

Wizard and the Princess $29.00 

The Next Step $34.00 

Mission Asteroid $22.00 

Mouskattack $3 1 .00 

Frogger $31 .00 

Cross Fire (ROM) $36.00 

SYNAPSE 

File Manager 800 t $69.00 

Chicken $26.00 

Dodge Racer $26.00 

Synassembler $30.00 

Page6 $19.00 

Shamus $26.00 

Protector $26.00 

Nautilus $26.00 

Slime $26.00 

Disk Manager $24.00 

OATASOFT 

PacifK Coast Highway $25.00 

Canyon Climber $25.00 

Tumt)le Bugs $25.00 

Shooting Arcade $25.00 

Clowns and Balloons $25.00 

Graphk; Master $30.00 

Graphic Generator $ 1 3.00 

Micro Painter $25.00 

Text Wizard $79.00 

Spell Wizard $84.00 

Bishop's Square $25.00 

Seiui* of Egypt $25.00 



FOR ATARI 

APX 

Text Formatter $18.50 

Family Budgeter $1 8.50 

Eastern Front $24.00 

Family Cash $18.50 

Jukebox $1 3.00 

Downhill $1 8.50 

Outlaw $18.50 

Holy Grail $24.00 

Player Piano $18.50 

Keyboard Piano $ 1 8.50 

Number Blast $13.00 

Frogmaster $18.50 

747 Land Simulator $18.50 

Word Processor $40.00 

EPYX 

Crush, Crumble & Chomp $24.00 

Crypt of the Undead $24.00 

Curse of Ra $1 6.00 

Datestones i Ryn $16.00 

Invasion Orion $19.00 

King Arthur's Heir $24.00 

Morioc's Tower $16.00 

Rescue at Rigel $24.00 

Rrcochet $ 1 6.00 

Star Warrior $29.00 

Temple of Asphai $29.00 

Upper Reaches of Apshai $ 1 6.00 

CBS 

K-razy Shoot Out $32.00 

K-razy Kritters $32.00 

K-razy Antics $32.00 

K-star Patrol $32.00 



•j 



#^ 



STICK 
STAND 



Arcade Action from your 
ATARI or VIC Joy Stick 



computer mail order ^A/es^ 

800-648-33i i 

IN NV. CALL (70BJBSS-BSB4. P.O. BOX BBSS, BTATELINE, NV. 88448 

INTBnNATiONAL onoBnai All shipments outside continental United States must be pre-paid by certified check onlyl Include 3<lb<minimum $3.00) shipping and handling 
■OUCATIONAL oiacouNTai Additional discounts are available from both Computer Mail Order locationa to qualified Educational Inatitutions. 



LANGUAGES 



An Introduction to FORTH 



by Ronald W. Anderson 



The author gives a brief 
introduction to the FORTH 
language, including a discussion 
of Reverse Polish Notation, word 
definitions, and stacic 
manipulation. 

FORTH was the result of the old adage 
that "necessity is the mother of inven- 
tion." Charles Moore developed 
FORTH as a tool to help him program 
computers more quickly than he could 
with an Assembler. 

If you have used a Hewlett Packard 
calculator, you are familiar with 
Reverse Polish Notation. FORTH 
works with this notation exclusively. 
Reverse Polish works well with a stack 
structure. HP used it to simplify the 
use of their calculators. The difference 
between Reverse Polish and ordinary 
algebraic notation may be seen in the 
way you key a simple problem into 
calculators that use these two nota- 
tions respectively. 

Algebraic 

2 -H 2 = 

2x3-1-4x5 = 
(2-1-3) X (4-1-5) = 

Reverse Polish 

2 (enter) 2 + 

2 (enter) 3x4 (enter) 5 x + 

2 (enter) 3 -(- 4 (enter) 5 -(- x 

The second and third problems 
above are done in exactly the same 
way; in algebraic notation, parentheses 
are necessary for one case but not the 
other, since multiplication takes 
precedence over addition. When using a 
Reverse Polish calculator, E^^^ER puts 
the first argument on the stack. The 
operator -(- or x , for example, puts the 
second number on the stack and oper- 
ates on the top two numbers, removing 



the two numbers that were there and 
leaving the result on top of the stack. 
(In the case of the calculator, the top 
item on the stack is always displayed.) 
With this notation, you can put a group 
of intermediate results on the stack and 
then perform the final operations. 
Though the idea might seem a bit 
strange at first, most HP users will 
testify that the operations may be per- 
formed with little or no thought. 

Several years ago, Consumei's 
Report did a review of all the calcu- 
lators available. They downgraded the 
HP severely because of the "strange 
notation." In a note a few issues later, 
they did a reverse. It seems that every- 
one who used the calculators eventu- 
ally wound up looking for the HP 
because it was easier to get the correct 
answer on it. 

FORTH, as you may have realized 
by now, relies heavily on a stack for all 
calculations. All of FORTH' s instruc- 
tions in some way manipulate the in- 
formation on the stack. FORTH in- 
structions are called "words." A word 
is defined by a "colon definition." A 
word may have any combination of 
ASCn characters as its name. "." is a 
FORTH word meaning the same thing 
as PRINT in BASIC. If you typed in the 
instructions: 

2 2*. (return) 

FORTH would respond with: 

4 OK 

All FORTH words or instructions 
must be separated by spaces. When 
FORTH sees a literal number, it auto- 
matically puts it on the stack, so an 
equivalent of the (enter) from the 
calculator is not necessary. (The space 
after the number tells FORTH that the 



number is complete.) Of course the 
"*" means multiply, and the "." 
means to print the result. Printing a 
result removes it from the stack. 
Assuming the stack was empty at the 
start of the above sequence of instruc- 
tions, it would be empty at the end. 
"OK" is FORTH's analog of READY in 
BASIC. Shown in figure 1 are the con- 
tents of the stack, as each item in the 
line above is encountered. 



Figure 1 








2 


3 


* 




TOP 2 


3 


6 


(empty) 


OF -* (empty) 


2 






STACK 









Now, let's define a word: 

: SQUARE DUP ♦ ; 

The word defined with a colon defini- 
tion is SQUARE. It will square the 
value on the stack. Now, if you type 2 
SQUARE . (return) FORTH will put 2 
on the stack. DUP is a FORTH word 
that will push a DUPlicate of the top 
item Onto the stack. " * " multiplies the 
top two items on the stack and leaves 
the result on top. 2 SQUARE . will 
therefore result in the value 4 being 
printed to the terminal. Now, of 
course, if you typed '5 SQUARE .' you 
would get 25 on the terminal. Further, 
the result of SQUARE does not need to 
be printed out. It could just as well be 
left on the stack for use by another 
calculation. You could type: 

3 SQUARE 4 SQUARE + . (RETURN) 

The result would be 9 -(- 16 or: 25 OK 



58 



MICRO 



No. 57 - February 1983 



LANGUAGES 



The definition of SQUARE is com- 
prised of just two other words, DUP 
and *. The semicolon terminates the 
word definition. 

Figure 2 shows a colon definition of 
a working square root function. First, a 
couple of variables are declared. They 
hold the number for which the square 
root is to be found, and for an inter- 
mediate GUESS or trial square root. The 
algorithm, called Newton's method, 
divides the number by a guess, and aver- 
ages the result with the guess to make a 
new guess. The process is repeated un- 
til the new guess and the old guess are 
either equal, or differ by 1 . (Remember, 
this is integer arithmetic. The result for 
some numbers will alternate between 
two numbers that differ by 1; for others 
it will reach a constant value.) 

SQRT expects the value of the 
number to be on the stack when SQRT 
is called. The number will be used 
several times in successive passes 
through the loop, so it is immediately 
stored in the variable NUMBER. Nam- 
ing a variable places its address on the 
stack. The word '!' makes FORTH use 
the top item on the stack as a pointer 
for a place to store the second item on 



Figure 2 

VARIABLE GUESS 
VARIABLE NUMBER 

SQRT 
NUMBER ! 2 GUESS ! 
BEGIN NUMBER @ GUESS 
GUESS @ -t- 2 / DUP 
GUESS @ SWAP GUESS ! 
- ABS 2 < UNTIL 
GUESS @ ; 



the stack. Remember that you are 
usually dealing with 16-bit words. 2 
GUESS ! puts 2 on the stack and stores 
it in the variable GUESS. BEGIN 
signals the start of a loop that ends at 
UNTIL. Within the loop, NUMBER 
and GUESS are fetched. @ has the 
reverse effect of !; it uses the top item 
on the stack as a pointer to a variable, 
and replaces the pointer value with the 
value of the variable on the stack. 

Next, the word 7' divides NUM- 
BER by GUESS; the result remains on 
the stack. Now GUESS is fetched again 
and added to the result. 2 / divides the 
sum by 2 and you have averaged the 



result of the divide with the original 
guess, so the new guess is now on the 
stack. DUP duplicates the new guess 
on top of the stack, and GUESS @ puts 
the old one on top. Now you want to 
save the new guess in GUESS, but it is 
second on the stack, so use SWAP to 
get it on top and then GUESS ! to put it 
in GUESS. Now you have the new 
guess and the old guess as the two top 
items on the stack so subtract and take 
the absolute value of the difference ( - 
ABSj. You must set up a comparison 
that will leave FALSE (0) on the stack 
until you want to exit the loop. 2 < 
UNTIL compares the value on the 
stack with 2 and leaves TRUE when the 
value is less than 2 (0 or 1|. At that 
point the loop is done and you simply 
pull the last guess as the result and 
return with the result on the stack. 

It is my understanding that an avid 
FORTH fan frowns on the use of vari- 
ables if it can be avoided. He would 
probably figure out a way to keep both 
GUESS and NUMBER on the stack (as 
nameless values) and manipulate the 
values with DUP, ROT, and OVER, 
words that move the top values around 
in various ways. I believe such code. 




' ^injf fy'ff M 1 




• 1 Ik 



u^o^i^^iAdJ 



THE PROFESSIONAL'S CHOICE 
FORTH — A Tool for Craftsmen! 

It has been said that if Chippendaie had made programs he would 
have used FORTH as his tool. If you want to learn how to program, 
use a teaching language — PASCAL or BASIC. If you know how to 
program, use a language designed for craftsmen — FORTH. 

FORTH Systems 

For ail FLEX systems; 6800 & 6809. Specify 5" or 8" diskette and 
hardware configuration. For standalone versions, write or call. 

* * tFORTH— extended fig-FORTH (1 disk) $1 00 ($15) 
** tFORTH -t-— extended more! (3 5" or 2 8" disks) $250 ($25) 

tFORTH + includes 2nd screen editor, assembler, extended 
data types and utility vocabularies, GOING FORTH CAI course 
on FORTH, games, and debugging aids. 

TRS-80 COLORFORTH — 10K ROM Pack 

Full screen editor. Will work on 4K, 16K, or 32K systems 
$1 10 ($20). Disk versions available. 

Applications Programs 

* * f irmFORTH 6809 tFORTH + only $350 ($ 1 0) 

For target compilations to rommable code. Deletes unused 
code and unneeded dictionary heads. Requires tFORTH + . 

* * TINY PASCAL compiler in FORTH. 6800/09 $75 ($20) 
** FORTH PROGRAMMING AIDS; Extensive debugging, decom- 
piling, and program analysis tools. $150 ($10) 

Manuals alone, price in ( ). Add $5/system for shipping. $12 for 
foreign air TgUjot Microsystems 

1927 Curtis Ave., Redondo Beach, CA 90278 
(213)376-9941 

(TM) tFORTH, COLORFORTH and lirmFORTH are trademarks of Talbot Microsystems. 
(TM) FLEX is a trademarii of Tecfinicai Systems Consultants. 




Ver. 2 For your APPLE II/II+ 

The complete professional software system, that meets 
ALL provisions of the FORTH-79 Standard (adopted Oct. 
1980). Compare the many advanced features of FORTH — 
79 with the FORTH you are now using, or plan to buy! 
FEATURES OURS OTHERS 



79-Standard system gives source portability. YES 
Professionally written tutorial & user manual 200 PG. 

Screen editor with user-definable controls. YES 

Macro-assembler with local labels. YES 

Virtual memory. YES 

Both 13 & 16-sector format. YES 

Multiple disk drives. YES 

Double-number Standard & String extensions. YES 

Upper /lower case keyboard input. YES 

LO-Res graphics. YES 

80 column display capability YES 

Z-80 CP/M Ver. 2.x & Northstar also available YES 

Affordable! $99.95 
Low cost enhancement option: 

Hi-Res turtle-graphics. YES 

Floating-point mathematics. YES 

Powerful package with own manual . 

50 functions in all, 

AM951 1 compatible. 

FORTH-79 V.2 (requires 48K & 1 disk drive) 
ENHANCEMENT PACKAGE FOR V.2 

Floating point & Hi-Res turtle-graphics 
COMBINATION PACKAGE 
(CA res. add 6% tax; COD accepted) 



$ 99.95 

$ 49.95 
$139.95 



MicroMotion 

12077 Wilshire BM. #506 
LA., CA 90025 (2131821-4340 
Specify APPLE. CP/M or Northstar 
Dealer inquiries invited. 




No. 57 - February 1983 



MICRO 



59 



LANGUAGES 



though perhaps a bit more efficient, is 
too hard to follow. The use of variables 
with fetch and store instructions makes 
the program much more readable. 

Now let's define a third word, 
HYPOTENUSE, that will put the first 
two together. 

: HYPOTENUSE 

SQUARE SWAP SQUARE + SORT ; 

HYPOTENUSE is called with the 
length of the two sides of a right 
triangle on the stack. It returns the 
length of the hypotenuse. 

3 4 HYPOTENUSE . 5 OK 

5 12 HYPOTENUSE . 13 OK 

100 100 HYPOTENUSE . 141 OK 

The above example shows how to 
first define low-level words and then 
use them to define higher-level words. 
A FORTH program is built like this, 
starting with low-level word defini- 
tions, and continuing with higher- and 
higher-level words, until very few words 
can be combined to accomplish a task. 

The trick of writing programs in 



FORTH is simply to keep track of what 
is on the stack at every point in the pro- 
gram. This is facilitated by keeping 
word definitions short. A bit of code 
that leaves a data value on the stack 
somewhere in the program may do no 
harm, but if it is in a loop that repeats 
many times, it will eventually cause 
the stack to overflow and crash the pro- 
gram. Code that removes more from the 
stack than it puts on causes a STACK 
UNDERFLOW error and most FORTH 
implementations will tell you so. 

Actually, the previous discussion is 
a bit of an oversimplification, since 
FORTH actually uses two stacks — the 
parameter stack and the return stack. 
The return stack is used to keep track 
of the program flow from colon defini- 
tion to colon definition, and it is usually 
transparent to the user. Advanced tech- 
niques may involve using words to 
manipulate the return stack, as well. 

FORTH has a core of standard 
words for mathematical operators, 
data-handling words, and decision 
making. One of the differences among 
the FORTH implementations is how 
many core words are implemented in 
assembler, as opposed to word defini- 



tions in FORTH. Assembler-defined 
words generally run faster than the 
FORTH-defined words. Also, the main 
part of FORTH will be smaller if more 
of the core is implemented in 
assembler. 

The normal math functions in 
FORTH are based on 16-bit integer 
arithmetic, so numbers have the range 
of 32767 to -32768. The implemen- 
tations discussed in the companion 
article (pg. 62] have additional standard 
FORTH words defined that allow 
manipulation of larger integer 
numbers, such as D* for double preci- 
sion multiply, etc. You can write a 
floating-point math package in FORTH 
if it is required for your applications. 
You can tailor the package to your 
needs, so that you don't have to suffer 
with the slow calculations of a 12-digit 
floating-point math if you need only six 
or seven digits. Such routines have 
been published and some are commer- 
cially available. 

The author may be contacted at 3540 
Sturbridge Ct., Ann Arbor, MI 48105. 

/MCftO 



Perry PerjpIieraIs RepaIrs KIMs!! 

(SYlVIs ANd AIMS Too) 

• We will Diagnose, Repair, and Completely Test your Single Board Computer 

• We Socket all replaced Integrated Circuits 



You receive a 30-day Parts and Labor Warranty 
• Your repaired S.B.C. returned via U.P.S. — C.O.D., Cash 

Don't delay! Send us your S.B.C. for repair today 
Ship To: (Preferably via U.P.S.) 

Perry PerIpIieraU 

6 Brookhaven Drive 
Rocky Point, NY 11778 

KIM-1 RspUcEMENT ModuLES 

• Exact replacement for MOS/Commodore KIM-1 S.B.C. 

• Original KIM-1 firmware — IK and 4K RAM versions 

Replacement KIM-I KEyboARds 

• Identical to tfiose on early KIMS — SST switch in top right corner 

• Easily installed in later model KIMs 

Perry Peripherals is an authorized HDE factory service center. 

Perry Peripherals carries a full line of the acclaimed HDE expansion components for you KIM, SYM, and AIM, 
including HAM boards, Disk Systems, and Software like HDE Disk BASIC V1.1. Yes, we also have diskettes. For 
more information write to: P.O Box 924, Miller Place, NY 11764, or Phone (516) 744-6462. 



60 



MICRO 



No. 57 - February 1983 




The 68000 

DREAM MACHINE 



WE (SORT OF) LIED: 

Motorola has been promoting its advanced microprocessor 
chip as a vehicle tor large, complex systems exclusively. 
Now^, the 68000 does w^ork w^ell as the heart of big, complex 
systems. But their promotional literature implies that one 
can only build big, complex systems w^ith the 68000, and that 
is dead wrong (in our opinion). Nevertheless, the public 
(that's you!) perception of the 68000 tollow^s Motorola's line: 
Big systems. Complex systems. 

Our boards are not complex and not necessarily big (starting 
at 4K). Our new^sletter is subtitled "The Journal of Simple 
68000 Systems." But since the public has become condi- 
tioned to the 68000 as a vehicle for FORTRAN, UNIX, LISP, 
PASCAL and SMALLTALK people naturally expect all these 
w^ith our $595 (starting price) simple attached processor. 
Wrong! 

We wrote our last ad to understate the software we have 
available because we wanted to get rid of all those guys who 
want to run (multi-user, multi-tasl<ing) UNIX on their Apple II 
and two floppy disks. Running UNIX using two 143K floppies 
is, well, absurd. The utilities alone require more than 5 
megabytes of hard disk. 

HERE'S THE TRUTH: 

We do have some very useful 68000 utility programs. One of 
these will provide, in conjunction with a suitable BASIC com- 
piler such as PETSPEED (Pet/CBM) or TASC (Apple II), a five 
to twelve times speedup of your BASIC program. If you have 
read a serious compiler review, you will have learned that 
compilers cannot speed up floating point operations 
(especially transcendentals). Our board, and the utility soft- 
ware we provide, does speed up those operations. 

Add this line in front of an Applesoft program: 

5 PRINT CHR$(4);"BLOADUTIL4,A$8600":CALL38383 

That's all it takes to link our board into Applesoft (assuming 
you have Applesoft loaded into a 16K RAM card). Now run 
your program as is for faster number-crunching or compile it 
to add the benefit of faster "interpretation". Operation with 
the Pet/CBM is similar. 

68000 SOURCE CODE: 

For Apple II users only, we provide a nearly full disk of un- 
protected 68000 source code. To use It you will have to have 
DOS toolkit ($75) and ASSEM68K ($95), both available from 
third parties. Here's what you get: 

1) 68000 source code for our Microsoft compatible floating 
point package, including LOG, EXP, SQR, SIN, COS, TAN, 
ATN along with the basic four functions. The code is set up to 
work either linked into BASIC or with our developmental 
HALGOL language. 85 sectors. 



2) 68000 source code for the PROM monitor. 35 sectors. 

3) 68000 source code for a very high speed interactive 3-D 
graphics demo. 115 sectors. 

4) 68000 source code for the HALGOL threaded interpreter. 
Works with the 68000 floating point package. 56 sectors. 

5) 6502 source code for the utilities to link into the BASIC 
floating point routines and utility and debug code to link into 
the 68000 PROM monitor. 113 sectors. 

The above routines almost fill a standard Apple DOS 3.3 flop- 
py. We provide a second disk (very nearly filled) with various 
utility and demonstration programs. 

SWIFTUS MAXIMUS: 

Our last advertisement implied that we sold 8MHz boards to 
hackers and 12.5MHz boards to businesses. That was sort of 
true because when that ad was written the 12.5MHz 68000 
was a very expensive part (list $332 ea). Motorola has now 
dropped the price to $1 1 1 and we have adjusted our prices ac- 
cordingly. So now even hackers can afford a 12.5MHz 68000 
board. With, we remind you, absolutely zero wait states. 

'Swiftus maximus'? Do you know of any other 
microprocessor based product that can do a 32 bit add in 0.48 
microseconds? 

AN EDUCATIONAL BOARD? 

If you want to learn how to program the 68000 at the 
assembly language level there is no better way than to have 
one disk full of demonstration programs and another disk full 
of machine readable (and user-modifiable) 68000 source 
code. 

Those other 'educational boards' have 4MHz clock signals 
(even the one promoted as having a 6MHz CPU, honest!) so 
we'll call them slow learners. They do not come with any 
significant amount of demo or utility software. And they com- 
municate with the host computer via RS 232, 9600 baud max. 
That's IK byte/sec. Our board communicates over a parallel 
port with hardware AND software handshake, at 71 K 
bytes/sec! We'll call those other boards handicapped 
learners. 

Our board is definitely not for everyone. But some people find 
it very, very useful. Which group do you fit into? 

DIGITAL ACOUSTICS 

1415 E. McFadden, Ste. F 

Santa Ana, CA 92705 

(714) 835-4884 



Apple. Applesoft and Apple II are trademarks of Apple Computer Company. Pet Is a trademark of Commodore Business Machines. ■ 



No. 57 - February 1983 



MICRO 



61 



LANGUAGES 



FORTH for the 6809 



by Ronald W. Anderson 



The various versions of FORTH 
available for 6809-based 
computers are discussed. These 
include CCFORTH for the Color 
Computer, fig-FORTH, and 
several FLEX-based systems. 

fig-FORTH 

No discussion of FORTH would be 
complete without mention of the 
FORTH Interest Group (fig). Fig has 
implemented FORTH for most of the 
processors that are commonly used in- 
cluding the 6800, 6809, 6502, and 
68000. Source listings of fig-FORTH for 
these processors are available from fig 
for a nominal charge (it was around $15 
when I bought it) . 

The 6809 version is compatible at 
the most minimal level with the FLEX 
operating system. It is implemented as 
(or includes) its own disk operating 
system, accessing disk sectors directly. 
Depending on the number of bytes per 
sector, it utilizes four or eight sectors 
to form a unit of memory called a 
screen. A screen is a terminal screen 
full of information, consisting of 16 
lines of 64 characters. The FORTH disk 
operating system is workable, but 
primitive by present day standards. 
There is no directory facility. Standard 
practice is to use the first line of every 
screen as a description of the contents, 
a type of comment line. A FORTH 
word will list the first lines of all the 
screens, forming a directory of sorts. 
What serves to make the use of this 
disk operating system a bit more dif- 
ficult, is that the sectors written by fig- 
FORTH may not be accessed by or 
through the FLEX operating system (ex- 
cept through a sector dump utility) . 

Included in the fig-FORTH system 
is a line editor that allows you to access 
and change information stored in 
screens. Some of the more advanced 
systems have a screen editor that is a bit 
more convenient than the fig line editor. 



When you write a program or ap- 
plication, you edit some screens, put- 
ting your word definitions on them. 
You may at any time load a range of 
screens, which causes them to be com- 
piled so the program may be run. 
Therefore, you can debug your program 
interactively, ruiming and editing 
screens alternately. There is a screen 
buffer that can hold from two to several 
screens, so they don't have to be writ- 
ten to or read from disks for every 
change. FORTH keeps track of whether 
a screen has been updated, and won't 
let it be overwritten in the screen buffer 
without automatically rewriting it to 
the disk. That is a very handy feature. 

Fig-FORTH as supplied has the 
source code for FORTH and some 
FORTH screens that must somehow be 
bootstrapped into the system to get the 
editor working. The disk operating sys- 
tem ties to FLEX and is compatible at 
the disk driver level. I have the fig im- 
plementation and have typed it in and 
gotten it up and running. If you are new 
to FORTH, however, I would not rec- 
ommend going the fig route. However, 
if you can learn FORTH first on another 
system, the fig route is an inexpensive, 
though time consuming, way to go. 

FORTH from Talbot Microsystems 

Ray Talbot, who wrote the fig im- 
plementation for the 6809, sells an 
implementation of FORTH through his 
company, Talbot Microsystems. Tal- 
bot's implementation, known as 
tFORTH, offers features that make it 
easier to use with FLEX. The disk con- 
taining the FORTH compiler has 
several tracks that are initialized in the 
standard FLEX format. This allows the 
user to have the FORTH compiler on 
those tracks and to call it with a stan- 
dard FLEX call. The user may put FLEX 
itself, the necessary utilities to boot 
FLEX, and perhaps some utilities such 
as COPY, LIST, etc., on those tracks 



also. The remainder of the disk is used 
by FORTH directly as screen storage. 

FORTH will access a second disk 
drive when the screen number re- 
quested goes beyond the range of those 
numbers available on the first drive (a 
handy feature) . There are some utilities 
included in FORTH to do an index, list 
screens over a range of specified num- 
bers and list them formatted three to a 
page for a printer. Other utilities are in- 
cluded to copy one screen to another 
and delete screens. 

In addition to tFORTH, Talbot has 
available an extended version called 
tFORTH -I- , The added features are a 
screen-oriented editor, a full 6809 
assembler, a CASE statement, and 
some additional data types such as 
ARRAYS. Another program available 
from Talbot is firmFORTH. firm- 
FORTH allows you to shrink a finished 
application program to a bare 
minimum by including only the core 
words that you have used in your ap- 
plication. It eliminates everything else, 
and generates only the necessary binary 
code that you may bum into an 
EPROM for a dedicated application, or 
save on a disk for quick load and run. 

XFORTH from Frank Hogg Labs 

Frank Hogg Laboratories of 
Syracuse, NY, also supplies a FLEX- 
compatible version of FORTH called 
XFORTH. XFORTH includes a com- 
prehensive manual that contains a 
tutorial on FORTH as well as an exten- 
sive FORTH Glossary. This implemen- 
tation comes complete with many 
FORTH screens of application pro- 
grams that aid you in using FORTH, 
including a complete double- and 
triple-precision integer arithmetic 
package, an extensive Screen Editor, 
and a complete 6809 assembler. Ver- 
sions are provided for several terminal 
models. With a bit of study, they may 
be adapted to most any terminal that 



62 



MICRO 



No. 57 - February 1983 



LANGUAGES 



allows computer-controlled cursor posi- 
tioning, cursor home, and screen erase. 
XFORTH varies from the fig stan- 
dard disk operating system. It still uses 
the screen concept, but an application 
or program is kept in a standard FLEX 
file. To load a particular application, 
you load the FLEX file into a screen buf- 
fer. Now screens in the program may be 
accessed just as in standard FORTH. 
When desired, the program may be 
saved to a disk file. The advantage of 
this file-handling method is that the 
disk is completely compatible with 
FLEX utilities to get a DIRECTORY, 
LIST a file, COPY a disk, etc. It makes 
life a bit easier for someone who uses a 
number of different languages and 
wants to keep things on a more com- 
mon base. 



CCFORTH from Frank Hogg Labs 

Frank Hogg Laboratories also offers 
a version of FORTH that runs on the 
TRS-80 Color Computer. It uses the 
TRS-80 disk operating system, so it is 
not necessary to have FLEX on the CC 
in order to use it. CCFORTH contains a 
screen editor and some other features 
that make it particularly well adapted 
to use with the Color Computer. The 
screen editor uses the four directional 
arrow keys on the CC to position the 
cursor in the command mode. You may 
also delete characters or lines and in- 
sert blank spaces or lines in this mode. 
By typing ENTER, you enter the insert 
mode; then you may type Ln lines of text 
or insert characters Ln blank spaces. 

I used this editor for entering and 
testing the HYPOTENUSE program 
described in the companion article (p. 
). The three word definitions fit 
nicely on one screen. To get into the 
editor mode, type < screen number > 
EDIT. When you are done, type 
< screen number > LOAD, and your 
newly defined words are added to the 
dictionary. If you get any error 
messages, you can FORGET SQUARE 
(the first new word) and re-edit your 
definitions. This process is repeated 
until your program runs. Because of the 
display width limitation on the CC, 
CCFORTH screens are 32 lines of 32 
characters rather than the standard 16 
lines of 64 characters. I found I liked 
that anangement better. The shorter 
lines allow for better program phrasing. 

Charles Moore, the inventor of 
FORTH, has said that FORTH is about 
as controversial as religion or politics. 



He maintains that a good way to start 
an argument among programmers is to 
say "Boy, FORTH is a great language." 
I have mixed feelings about FORTH; it 
is difficult to learn, and reading some- 
one else's program can be a problem 
(though I am beginning to see that 
FORTH programs can be readably writ- 
ten. Keeping track of all the data 
floating around on the stack can be 
most frustrating, particularly to a 
beginner. However, in spite of a few 
misgivings, I never cease to be im- 
pressed with how much you can do 
with FORTH with so little source code! 
My guess is that with equally well- 
documented and formatted programs in 
FORTH, Pascal, and BASIC, the 
FORTH program will be considerably 
shorter and will run considerably faster 
than any of the others. 



68'FORTH for 6809 available as a 
printed listing from; 

FORTH Interest Group 

P.O. Box 1105 

San Carlos, CA 94070 
Write for their current catalog and 
prices. 

tPORTH, tFORTH-i-, and firmFORTH 
available from: 

Talbot Microsystems 

1927 Curtis Ave. 

Redondo Beach, CA 90278 

tFORTH $100.00 

tFORTH-i- $250.00 

firmFORTH $350.00 

(requires but does not include 
tFORTH -h) 

XFORTH, CCFORTH available from: 

Frank Hogg Laboratories 

130 Midtown Plaza 

Syracuse, NY 13210 

XFORTH $149.95 

plus $2.50 shipping (huge manual) 
CCFORTH $ 99.95 



The author may be contacted at 3540 
Sturbridge Ct., Ann Arbor, MI 48105. 



iMCftO 



BIOSTATISTICS III 



giTCCN lEKIlDN CBHPMIim 




WATANABE PLOTTER GRAPHICS 



BIOSTATISTICS III is a combined stat- 
istical analysis and graphical data 
plotting software package . It covers a 
comprehensive range of bivariate and 
multivariate tests cominonly used in 
enigi nee ring and the social and medical 
sciences . 



SPECIAL FEATURES: 

1) Generates regression plots in screen 
high resolution graphics and on the 
Wantanabe WX 4671 plotter. 

2) Stores data in standard DOS 3.3 text 
files , easy to access from your own 
software or data base. 

3 ) Programs are written in Applesoft 
Basic. Can be user modified. 

4) Includes extensive data editing and 
file manipulation facilities . 

5 ) Tabulated data printouts and stat- 
istical results. 



STATISTICAL TESTS: GRAPHICS 

STANDARD DEVIATION 

PAIRED STUDENT (t) TEST 

UNPAIRED STUDENT (t) TEST 

WILCOXON PAIRED TEST 

MANN-WHITNEY U TEST 

A N V A (ONE AND TWO WAY) 

LINEAR REGRESSION * 

EXPONENTIAL REGRESSION * 

POLYNOMIAL REGRESSION * 

CURVILINEAR REGRESSION * 

MULTIPLE REGRESSION 

SYSTEM REQUIREMENTS: 

Apple 2 plus with 48k RAM and two Disk 
Drives. Also compatible with the Apple 
3 in emulation mode. 

The package includes documentation and 
both program and data discs. 



PRICE 



$95.00 



Personal checks, COD or P.O.* on 
of f ical order forms , accepted . 
California residents add 6% sales tax . 

Write for more information or order 
from 1 

A2DEVICE5 P.O.BOX 2226 ALAMEDA 
CALIFORNIA 94501. TEL (415) 527-7380. 




Pft02 140 

SCREEN GRAPHICS DUMP TO EPSON MX80 

APVLE i« a r»gl«t*r«c3 ir»<3«»Brk o' Appl* Conputir*. Inc. 
HATMIABE la ■ raqlacared ciadmark of Waeanaba Corporaelon. 
EPSON I» • raqlstarad trsdenHih ot Epson America, Inc. 



No. 57 - February 1983 



MICRO 



63 




P-LISP 



You don't need to be great with 
numbers to learn programming 
in LISP. Because LISP uses words 
instead ot numbers, so you can 
start lO program logically with- 
out v/orrying about math. For 
those who require it the new 
P-USP version 3. 1 supports tloat- 
ing point math, Hi-res graphics, 
trig tunctions and all disk tile 
tunctions. 

P-USP is sold with a tun, easy 
to read Tutorial that teaches you 
LISP with hands on experience 
You need an Apple U® or II to 
mn P-USP 
Educators: USP Is a great teach- 
ing language. 

Write to us for special quantity 
pricing. 



single copy price 

$149.95 

(includes tutorial) 



d 



iSm 



4005 Chestnut Street Philadelphia, PA 19104 215-387-1500 
Toll Free (orders only) 800-523-0725 

Apple II 11 IS a registered trademark ol Apple Computers Inc 



64 



MICRO 



No. 57 ■ February 1983 



LANGUAGES 



The World According to LISP 

by Steven Cherry 



LISP has always been considered 
a language for large computers. 
In this introduction, learn about 
LISP as it is implemented 
on a microcomputer. 



Many people who work with com- 
puters believe LISP is a strange and 
obscure language used only by mad 
computer scientists who are locked 
away in research laboratories or univer- 
sities working in that nebulous field 
commonly known as Artificial Intelli- 
gence (AI) . Indeed, because LISP gener- 
ally has been restricted to use only on 
large computer systems, few have been 
able to obtain exposure to this language 
outside an AI or academic environ- 
ment. However, with the introduction 
of P-LISP for the Apple II, as well as 
other LISP interpreters for other ma- 
chines, this trend is rapidly changing. 
For Apple owners, access to a compre- 
hensive and quite powerful LISP inter- 
preter is now at their fingertips. It is 
therefore a worthwhile endeavor to 
take a close look at LISP to see what 
we've been missing for so long. 

LISP stands for "LISt Processor." It 
was developed by John McCarthy at 
MIT in the late 1950's, originally as a 
tool for mathematical research. 
Because of its unique features, LISP 
quickly caught on as the language of 
choice for work in Artificial Intelli- 
gence. Unlike Pascal or FORTRAN, 
there is no real LISP standard. Today 
LISP is available in various flavors, 
such as INTERLISP, MACLISP, 
MTSLISP, and, of course, P-LISP. How- 
ever, all LISPs more or less look and act 
the same and are descendants of Mc- 
Carthy's LISP 1.5. 



What makes this language so 
unique? The major strengths and fea- 
tures of LISP can be outlined as follows: 

• LISP uses the same data structure to 
represent both programs (actually 
functions) and data. Since programs 
and data are indistinguishable [as far 
as the LISP interpreter is concerned), 
it is relatively easy to write LISP pro- 
grams that construct and execute 
other LISP programs. 

• LISP is interpreted, providing the 
user with immediate response. The 
interactive nature of LISP makes it 
easier to develop and debug programs 
and gives the user the feeling that he 
is talking to the computer. 

• LISP has a simple and uniform syn- 
tax; there are only a few rules to 
remember, and these quickly become 
second nature. Moreover, LISP is in- 
dependent of the details of the 
machine on which it is running; 
there is no need to deal with word 
sizes, the lengths of variable names, 
declarations, etc. 

• LISP is ideal for applications requir- 
ing symbolic manipulation because, 
unlike BASIC or Pascal, LISP deals 
with objects rather than strings, 
records, variables, pointers, etc. All 
of the bookkeeping necessary for 
representing or manipulating these 
objects is implicit in the language; for 
example, a program to differentiate 
polynomials might be a chore to 
write in BASIC or Pascal, but is 
relatively simple and straightforward 
in LISP. 

• LISP is a heirarchical language; LISP 
programs are actually functions, each 
constructed out of more primitive 
functions. A LISP interpreter is little 
more than a set of pre-defined func- 
tions. It is thus possible to build en- 
tire systems (for example, the pro- 
gramming language Smalltalk) out of 



LISP primitives, and other systems 

on top of these, etc. 
So the picture doesn't appear too 
perfect, I must point out that, as with 
any language, LISP has some draw- 
backs as well. Chief among these is its 
memory demands: this language is a 
memory hog and, although it can fit on 
a micro (P-LISP is roughly 14K in 
length and supports about 80 functions), 
this demand can be quite limiting, 
depending on the specific application 
involved. Performance is another fac- 
tor; because LISP is interpreted, execu- 
tion speed is much slower than that of a 
compiled language such as Pascal 
[however, some systems do have LISP 
compilers available) . A third problem is 
the simple syntax of LISP, which can be 
a liability as well as an asset. It is quite 
easy to write a LISP function that is so 
hopelessly obscure as to baffle even the 
person who wrote it. 

The Structure of LISP 

The basic unit of information in 
LISP is the atom. There are liteial 
atoms, which are represented as a se- 
quence of alphanumeric characters 
beginning with a letter, and numeric 
atozns, which are simply numbers. 
Thus, A, HELLO, PQR57, and WALRUS 
are literal atoms, while 12 and - 56.87 
are numeric atoms. 15AYT would not 
be an atom. The sequence of characters 
that denote an atom are called the 
atom's piint name. For example, the 
print name of atom DEF is the se- 
quence of characters D, E, and F. 

Atoms can be combined to form the 
basic data structure of LISP, the list. A 
list is simply a sequence of symbolic 
expressions or s-exprs, bound by a pair 
of parentheses, where a s-expr is de- 
fined to be an atom or a list. So, (A B C) 
is a list comprised of three s-exprs, the 
atoms A, B, and C. Similarly, (HAIL 



No. 57 - February 1983 



MICRO 



65 



LANGUAGES 



AND (WELL MET) ) is a list comprised 
of three s-exprs — namely, the atom 
HAIL, the atom AND, and the list 
(WELL MET), which in turn is com- 
prised of the two atoms WELL and 
MET. A list may contain any number of 
atoms or lists as its elements. Be aware 
that the parentheses are not part of the 
list; they are punctuation marks that 
define the list [just as a pair of quotes 
defines a string in BASIC). 

At the heart of LISP is the evaluatoi. 
Whenever you type something into 
LISP, the interpreter tries to evaluate 
what you typed in and return the result 
(this is known as a READ-EVAL- PRINT 
loop). If, for some reason, LISP cannot 
evaluate your input, it will give you a 
friendly enor message indicating where 
it got stuck and why. Actually, enor 
recovery in LISP is entirely 
implementation-dependent; there is 
nothing in the definition of the lan- 
guage that specifically states what 
course of action should be taken if an 
enor condition arises. 

The following rule is used for 
evaluating lists: when you give LISP a 
list to evalute, LISP treats the first ele- 
ment of the list as the name of a func- 
tion, and the remaining elements (if 
any) as the arguments to the function. 
So, if you type the list (A B C), LISP 
will try to apply some function named 
A to the arguments B and C. For exam- 
ple, suppose you want to add two num- 
bers together. In BASIC, you would 
type something like PRINT 1 + 2 to add 
1 and 2. In LISP, you can accomplish 
this by typing (ADD 1 2). ADD is a 
built-in function that takes two 
arguments — namely, two numeric 
atoms — and returns the sum of the 
arguments (in this case 3). The value of 
a s-expr is the value returned when the 
s-expr is evaluated. So the value of 
(ADD 1 2] is the atom 3. 

What if you type in something that 
doesn't make much sense, like [ADD 1)? 
Since the function ADD expects two ar- 
guments, you should get an enor mes- 
sage. P-LISP will give the following: 

** ERROR: TOO FEW ARGS ** 
ADD:: (1) 

The first line of the message indicates 
what's wrong, and the next line shows 
the function and the list of arguments 
LISP was working on when the error 
occurred. 

Atoms may have values associated 
with them, just like a variable in 
BASIC or Pascal can be assigned a 



value. If you type an atom into LISP, 
the interpreter will return the value of 
the atom, if it has one. For example, 
numeric atoms are defined to have 
themselves as their value. The value of 
the atom 3 is 3 (as you'd expect). If you 
type 3 into LISP, you'll get back 3, the 
same as if you'd typed [ADD 1 2). As a 
general rule, literal atoms don't have a 
value until they're given one. The value 
cf a literal atom may be any s-expr. 

One thing you can do with lists is 
take them apart. The LISP function 
CAR takes a list and returns the first 
element of the list. If you type (CAR ' (A 
B C) ) you get A as the value. When you 
give LISP something to evaluate, of the 
form (Function Argl Arg2 . . . Argn) 
LISP first evaluates the arguments, 
then applies the function to the argu- 
ment values to return the final result. 
For example, if the value of A is 1, and 
the value of B is 2, then (ADD A B) will 
return 3. 

In the example for CAR above, the 
quote tells LISP not to evaluate the 
argument before applying the CAR func- 
tion. In other words, if you didn't type 
the quote, LISP would first try to evalu- 
ate the s-expr (ABC), then apply CAR to 
the result. With the quote, LISP applies 
CAR directly to (A B C), returning A. 

The LISP function CDR is the com- 
plement of CAR. CDR takes a list and 
returns that list minus the first ele- 
ment. So, (CDR '(ABC)) returns (B 
C). If you type (CDR '[HITHEREJ ) 
LISP gives NIL. NIL is a list containing 
zero elements, or the empty list. Also, 
NIL is represented by an empty pair of 
parentheses, [ ). NIL is considered a 
special element of LISP because it is 
both a list and an atom. NIL has itself 
as its value; i.e., the value of NIL 
is NIL. 

NIL also is used to represent the 
truth value "false". As you'd expect, 
there is an atom to represent the truth 
value "true" — namely, T. The value 
of T is T. NIL and T are the only literal 
atoms built into LISP with predefined 
values (actually, any non-NIL value in 
LISP is considered to represent "true". 
T is convenient because its value is 
always guaranteed to be non-NIL) . 

One area where T and NIL come in- 
to play is with predicates. Predicates 
are functions that perform a certain test 
on their arguments and return T if the 
argument passes the test and NIL if it 
fails. One such predicate is ATOM; 
ATOM returns T if its argument is an 
atom, and NIL otherwise. For example, 
[ATOM '(IM A LIST) ) returns NIL, 



whereas (ATOM 'BOMB] returns T. 
The s-expr (ATOM ( ) ) also returns T 
(remember, ( ) is an alternate represen- 
tation for NIL, which is an atom) . 

Another important predicate is 
NULL, which returns T if its argument 
is NIL, and NIL otherwise. So, (NULL 
'(8 9 10) ) returns NIL, but (NULL 
[CDR '(BLEAT) ) ) returns T. LISP first 
evaluates the arguments to a function, 
then applies the function to the result. 
In the above example, the argument to 
NULL is the s-expr (CDR '(BLEAT) ). 
LISP evaluates this and returns NIL, 
which is then passed on to NULL. The 
NULL of NIL is T, so T is returned as 
the value of the entire s-expr. 

Incidentally, CAR and CDR are the 
only functions in LISP whose names 
have nothing to do with their meaning. 
Their names are derived from the hard- 
ware on which the first LISP interpreter 
was implemented: CAR stands for 
"Contents of Address Register" and 
CDR stands for "Contents of Decre- 
ment Register." On some LISP systems 
they have been given the more mean- 
ingful names FIRST and REST; but for 
the most part, their original names 
have stuck. 

In addition to functions that take 
lists apart, LISP is supplied with func- 
tions to put lists together. One of these 
is the function CONS, for CONStract. 
CONS takes two s-exprs and returns a 
new list such that the first argument is 
the CAR of the list and the second argu- 
ment is the CDR of the list. For exam- 
ple, (CONS 'THIS '[IS FUN) ) returns 
(THIS IS FUN). Note that the CAR of 
this list is THIS, and the CDR is the list 
(IS FUN). 

CONS puts things at the front of 
lists. Another function, APPEND, puts 
things at the end of lists. For example, 
(APPEND '[THESE THAT) 'THOSE) 
returns [THESE THAT THOSE). 

Other functions used for building 
lists include CONC and LIST. CONC 
concatenates lists together and LIST 
creates a list of its arguments. Some ex- 
amples: (CONC '(I LISP] '[YOU LISP) ) 
returns (I LISP YOU LISP), and (LIST 'A 
'B '(AND C) ) returns [A B (AND C) ). 

I mentioned above that it is possible 
to assign values to literal atoms. This is 
done with the LISP fimction SETQ. 
The first argument to SETQ is the atom 
to be assigned a value and the second 
argument is the value. An anomaly to 
remember about SETQ is that the first 
argument is not evaluated, but the sec- 
ond argument is. For example, if you 
want to assign the atom A the value 



66 



MICRO 



No. 57 - February 1983 



(WHO AM I), type (SETQ A '(WHO 
AM I) ). Now whenever the atom A is 
evaluated, the list (WHO AM I) would 
be returned. 

Although there is no string data 
type in LISP, there are facilities to treat 
atoms' print names as though they 
were strings. One such facility is the 
special kind of literal atom called the 
string atom. A string atom is the same 
as a literal atom in all respects, except 
that its print name is delimited by a 
pair of double quotes. Any character 
may appear within the quotes (except a 
double quote). For example, "THIS IS 
A SINGLE ATOM" is a single atom 
whose print name is the sequence of 
characters between the double quotes. 
String atoms allow you to create atoms 
with "funny" print names; for in- 
stance, "(" can be an atom [it has 
nothing to do with the ( symbol used to 
denote lists). 

The LISP functions EXPLODE and 
IMPLODE allow the user to manipu- 
late print names. EXPLODE takes an 
atom and returns a list of the characters 
in the atom's print name,- thus, (EX- 
PLODE 'TNT) returns the list (TNT). 
IMPLODE does the reverse of EX- 
PLODE; it takes a list of atoms and 



returns an atom whose print name is 
the compression of the atoms in the 
list. For example, (IMPLODE '(N E U T 
RON)) returns the atom NEUTRON. 
Of course, LISP wouldn't be much 
fun or very useful unless you were able 
to create your own functions. The LISP 
function DEFINE is used to define func- 
tions. The general form of a function 
definition is as follows: 

(DEFINE (function-name (LAMBDA 
(fornnal arguments) 

function-body 



The function-name is a literal atom, 
which is what the function will be 
called. A LAMBDA-expiession follows 
the function-name; all user-defined 
functions must be some form of 
LAMBDA-expression. The second part 
of a LAMBDA-expression (following 
the atom LAMBDA] is a list of atoms 
that are the function's foimal 
aiguments (if the function takes no 
arguments, the list is NIL). This list 
tells LISP the number of actual 
arguments the function takes, and how 
these arguments are referred to in the 
body of the function [the example 



IHIH LANGUAGES | 

below will help clarify these points). 
The last part of the LAMBDA-expres- 
sion is the actual body of the function 
and is a s-expr whose value will be 
returned as the value of the function. 

As an example, suppose you want a 
function that returns the second ele- 
ment of a list; that is, if you gave the 
function the list [A B C), you want the 
function to return B. Call this function 
SECOND: 

(DEFINE (SECOND (LAMBDA (L) 
(CAR (CDR L) ) 
))) 

L is the formal argument of SECOND. 
When SECOND is invoked, L is bound 
(SETQed) to the value of the actual argu- 
ment and the function body (the CAR 
of the CDR of L) is evaluated. For ex- 
ample, if you type [SECOND '[ABC) ), 
L is bound to the list (ABC), and CAR 
(CDR L) ) is evaluated, returning B. 

Whenever a user-defined function (a 
LAMBDA-expression) is invoked, a 
local envhonment for the function is 
created consisting of the formal argu- 
ments of the function and the values 
they are bound to (known as LAMBDA- 
binding] at the time of the invocation. 



^ M^MUWMMM S®^^W^M® ^ 



THE TACKLER ~ - DUAL • MODE PARAUiL 
INTERFACE FOR THE APPLE* 2 BOARDS IN ONE FOR NO MORE 
COMPATIBlUn PROBLEMS! 

An intelligent board to provide easy control of your printer's full potential. 
Plus a standard parallel board at the flip of a switch - your assurance of 
compatibility with essentially all software for the APPLE*. Hires printing 
with sirrple keyboard commands that replace hard to use software 
routines. No disks to load. Special features include inverse, doubled, and 
rotated graphics and many text control features, available through easy 
keyboard or software commands. Uses Industry standard graphics 
commands. This is the first truly universal intelligent parallel interface! 
Change printers - no need to buy another board. Just plug in one of our 
ROI^'S and you're all set ROM'S available for Epson, C. Itoli, NEC, and 
Okidata - others ava ilable soon. Specify printer when ordering Call for 
Price. 





THE UP6RADEABLE PPC-100 
PARALLEL PRINTER CARD 

A Universal Centronics type parallel printer board complete with cable 
and connector Tt\is unique board allows you to turn on and off lt\e t\ijt\ 
bit so that you can access additional features in many printers. Easily 
upgradeal)le to a fully intelligent printer board with graphics and text 
dumps. Use with EPSON, C. ITOH, ANADEX, STAR-WRITER, NEC, OKI 
and others with standard Centronics configuration. J139.00 



IF YOU WANT GRAPHICS AND FORMAHING THEN 
CHOOSE THE PERFORMER 

for Epson, OKI, NEC 8023, C ITOH 8510 provides resident HIRES screen 
dump and print formatting in firmware. Plugs into Apple slot and easy 
access to all printer fonts through menu with PRif command. Use with 
standard printer cards to add intelligence. S49.QQ specify printer 




THE MIRROR FIRMWARE FOR NOVATION APPLE CAT 11" 

The Data Communication Handler ROM Emulates syntax of an other popular Apple Modem product 
with improvements. Plugs directly on Apple CAT H Board. Supports Videx and Smarterm 80 column 
cards, touch tone and rotary dial, remote terminal, voice toggle, easy printer access and much more. 
List $39.00 Introductory Price J29.00 



MINI ROM BOARDS 

Place your 2K program on our Mini Rom 
Board. Room for one 2716 EPROM. Use in any 
slot but zero. Only J34.95 



DOUBLE DOS Plus 

A piggy-back board that plugs into the disk- 
controller card so that you can switch select 
between OOS 3.2 and OOS 3.3 DOUBLE DOS 
Plus requires APPLE DOS ROMS J39.00 



Super Pix 

Hires screendurap software for the Epson, OKI, C. Itoh and Nee 8Q23. Use with Tyraac PPC-100, 
Special J19.95 (Specify Printed 

Mr. Lister - Customer Contact Profiler & Mailer 

A Super Mail List Plus more — up to 1000 Entries on single 3.3 Disk {only 1 Drive required) — 2 
second access time to any name — full sort capabilities — Dual Index Modes — supports new 9 
digit Zip. Easy to follow manual — Not Copy Protected — 4 user defined tables with 26 sort 
selections per table — Beta tested for 6 months — user defined label generation. 
Introductory Price $135. $99.00 Dealer &: DisL Inquiries Invited. 



APPLE UNK 

A communications system for the Apple* (Requires Hayes Micro lilodem). Transmit and receive any 
type of file between APPLES', Automatic multi-file transfer, real time clock indicating file transfer 
time. Complete error check. Plus conversation mode. Only one package needed for full transfers. 
Compatable with all DOS file types (requires Hayes Micro Modem) $59.00 



THE APPLE CARD/ATARI CARD 

Two sided 100% plastic reference card Loaded with information of interest to all Apple and Atari 
owners. ''■" 



NIBBLES AWAY II 

AGAIN! Ahead of all others. 

• AUTO-LOAD PARAMETERS . . . Free's the user from having to Manually Key in 
Param values used with the more popular software packages available for the Apple II. 

• EXPANDED USER MANUAL. . . incorporates new Tutorials tor all levels of 
expertice; Beginners Flowchart for 'where do I begin' to 'Advanced Disk Analysis' is included. 

• TRACK/SECTOR EDITOR ... An all new Track/Sector Editor, including the 
following features: Read, Write, Insert Delete Search, and impressive Print capabilities! 

• DISK DIAGNOSTICS . . Checks such things as: Drive Speed, Diskette Media 
Reliability, and Erasing Diskettes. 

• HIGHEST RATED . . . Best back up Program in Softalk Poll (Rated 8.25 out of 10), 

• CONTINUAL UPDATES. . . Available from computer Applications and new listings 
on the source, ^69.95 




Dealer and Distributor Inquiries Invited. 

/VIICRO-H^RE DIST. INC. 

P.O. BOX 113 POMPTON PLAINS, N.J. 07444 

201 '838-9027 



LANGUAGES 



This local environment remains in ef- 
fect until the function is exited. At that 
time, the environment is destroyed and 
the next most recent environment b 
comes the "current" environment. The 
highest-level environment (the one in 
effect before any functions are invoked) 
is called the global environment. 

Suppose you type (SETQ L '(THIS 
BETTER WORK) ) into LISP. The 
global value of L is now set to the list 
[THIS BETTER WORK). If you type 
(SECOND '(WHOS ON FIRST) ), a 
local environment for SECOND is 
created in which a local L is bound to 
the list (WHOS ON FIRST). The func- 
tion body is then evaluated. When the 
function is exited, the local environ- 
ment is destroyed and the value of the 
function body, the atom ON, is re- 
turned. If you now type L you get what 
you had before: (THIS BETTER 
WORK), which is the global value of L. 

One of the nicer features of LISP is 
that it allows the definition of recursive 
functions. A recursive function is a 
function that is defined in terms of 
itself. A perfect example is the factorial 
function, which is defined as follows: 

n! = 1 if n = 

n * (n- 1)! otherwise 

This, function can be represented very 
nicely in LISP: 

(FACTORIAL (LAMBDA (N) 
(COND 
((EQUAL N 0) 1) 
(T (MULT N (FACTORIAL (SUB N 1) ) ) ) 



COND is the LISP CONDitional 
construct and is analogous to the IF- 
THEN-ELSE construct in BASIC or 
Pascal. The form of the COND is as 
follows: 

COND (el si) 
(e2 s2) 

(en sn) ) 

which can be thought of as meaning 

IFe1 THEN s1 
ELSE IF e2THEN s2 
ELSE IF e3 THEN s3 

ELSE IF en THEN sn 
ELSE NIL 



Each e 1 is evaluated until one evaluates 
to a non-NIL value. The corresponding 
si is then evaluated and returned as the 
value of the COND. If all of the ei eval- 
uate to NIL, then COND returns NIL. 

In the FACTORIAL function above, 
the COND returns 1 if N is equal to 0. 
Otherwise, the MULT s-expr is eval- 
uated (note that the T forces this s-expr 
to be evaluated if the first test fails). 
The MULT contains a recursive call on 
FACTORIAL; the argument passed to 
FACTOIUAL here is N-1. The value 
returned by this call is multiplied by 
the "current" value of N [remember 
that each time FACTORIAL is invoked, 
a new "local" N is created and bound 
to the actual argument). 

A handy way to observe the evalua- 
tion of a function is via a function 
trace. Most decent LISPs are supplied 
with some mechanism for tracing func- 
tions, an indispensable debugging aid. 
A trace of a function displays the 
arguments passed to the function when 
it is invoked and the value returned by 
the function when it is exited. For ex- 
ample, in P-LISP, if you are tracing the 
ADD function and type (ADD 4 5), you 
would see 

> > ADD:: (4 5) 

< < ADD:: 9 

The > > arrow indicates a func- 
tion entering and the < < arrow 

indicates a function exiting. 

Suppose you want to see how the 
evaluation of FACTORIAL proceeds. If 
you trace the function and type (FAC- 
TORIAL 4), you will see the following: 

>> FACTORIAL:: [4) 

(level 1 — value of N is 4) 
>> FACTORLfUL:: (3) 

[level 2 — value of N is 3) 
> > FACTORL\L:: (2) 

(level 3 — value of N is 2) 
> > FACTORL^;: (1) 

(level 4 — value of N is 1) 
> > FACTORL\L:: (0) 

(level 5 — value of N is 0) 
<< FACTORIAL:: 1 

[level 5 — 1 is returned) 
<< FACTORIAL:: 1 

(level 4 — 1 is returned) 
< < FACTORIAL:: 2 

[level 3 — 2 is returned) 
<< FACTORL\L:: 6 

[level 2 — 6 is returned) 
<< FACTORIAL:: 24 

(level 1 — 24 is returned) 



Note that each level has its own 
"local" N, and the value of this N is 
multiplied by the value returned by 
FACTORIAL from the next level down. 
Although recursion is usually a sim- 
ple and elegant way to solve a program- 
ming problem, it is not always the best 
method to use. In particular, recursion 
tends to be inefficient. A great deal of 
overhead is involved when entering a 
function and setting up the local en- 
vironment, both in execution speed 
and memory consumption. If these fac- 
tors are critical, such overhead should 
be kept to a minimum. Luckily, LISP is 
provided with an iterative program- 
ming capability called PROG. Here is 
the definition of FACTORIAL using a 
PROG instead of recursion: 

(FACTORIAL (LAMBDA (N) 
(PROG (PROD) 
(SETQ PROD 1) 
LOOP 
(COND 
( (EQUAL N 0) (RETURN PROD) ) 

) 

(SETQ PROD (MULT PROD N) ) 

(SETQN (SUBN 1)) 

(GO LOOP) 



The first part of PROG is a list of 
local atoms to the PROG. In the exam- 
ple above, PROD is declared a local 
atom. Local atoms exist only in the 
context of the PROG and disappear 
when the PROG is exited. When the 
PROG is entered, their values are 
intially SETQed to NIL. 

Each s-expr in a PROG is evaluated 
in succession unless the s-expr is an 
atom. Such atoms are considered labels 
and are not evaluated (i.e., they are 
skipped). In the previous example, the 
atom LOOP is a label. The GO function 
causes flow-of-control to proceed to the 
label indicated in the GO (not unlike a 
GOTO in BASIC). 

The RETURN function is used to 
exit a PROG. The argument of the 
RETURN is evaluated and returned as 
the value of the PROG. If RETURN is 
not used to exit the PROG, then PROG 
returns NIL. 

The example given for FACTORIAL 
should now be easy to understand. 
When the PROG is entered, PROD is 
SETQed to 1 and the main loop is then 
entered. The first part of the loop is a 
test. If N is 0, the PROG is exited and 
PROD is returned; otherwise PROD is 
multiplied by N and N is decremented 



68 



MICRO 



No. 57 - February 1983 



LANGUAGES 



(SUB is the subtract function). GO 
then brings you back to the beginning 
of the loop. As you can see, the 
iterative FACTORIAL is functionally 
equivalent to the recursive version. 
The major difference is that although 
the iterative function is longer, it is 
probably faster and more efficient than 
the recursive one. 

LISP functions that are built into 
the interpreter are called SUBRs, for 
SUBRoutine. Functions that are defined 
by the user are called EXPRs. The 
EXPRs that you have examined so far 
are functions that take a known num- 
ber of arguments, as indicated by the 
function's formal argument list. 

The LISP mechanism for defining a 
function for which the number of 
arguments is not known is the FEXPR. 
FEXPRs are defined using the following 
format: 

(DEFINE (function-name (FLAMBDA 
(formal-argument) 

function-body 
))) 

The difference between a FEXPR and an 
EXPR is that a FEXPR contains a single 
formal argument in the formal argu- 
ment list. When such a function is in- 
voked, the formal argument is bound to 
the entire unevaluated list of actual 
arguments. For example, define the 
following function: 

(DEFINE (PRINTME (FLAMBDA (X) 
X))) 

If you now type (PRINTME LISP 
LISPER LISPEST), you get (LISP 
LISPER LISPEST). The formal argu- 
ment X gets bound to the list of actual 
arguments (LISP LISPER LISPEST). 
Note these arguments are not 
evaluated. The function then just 
returns X. 

If you want to define a function that 
adds up an arbitrary number of numeric 
atoms, the following functions will 
serve your needs: 

(DEFINE (ADDLIST (FLAMBDA (X) 
(ADDLIST2X)))) 

(DEFINE (ADDLIST2 (LAMBDA (X) 
(COND 

((NLILLX)O) 

(T (ADD (CAR X) (ADDL1ST2 (CDR X) ) ) 
)))) 

Since the function can take any num- 
ber of arguments, it has to be declared a 



FEXPR. This function, ADDLIST, 
simply passes the argument list to the 
function ADDLIST2, which recursively 
adds up the elements of the list. Note 
that a FEXPR should never be recur- 
sive, since its arguments are never 
evaluated. 

The final LISP feature discussed in 
this article is the property list, or p-list. 
A p-list is a list of properties and prop- 
erty values that may be associated with 
a literal atom. A p-list has the form 

(prop1 value 1 prop2 value2 ... 
propn valuen) 

For example, you may want to assign 
the property COLOR to the atom BALL 
with the property value RED. The LISP 
function PUT is used to put properties 
and values on an atom's p-list. Proper- 
ties must be literal atoms; a property 
value may be any s-expr. The s-expr 
(PUT 'BALL 'COLOR 'RED) puts the 
property COLOR with value RED on 
the p-list for BALL. 

The LISP function GET is used to 
retrieve property values. If you type 
(GET 'BALL 'COLOR), you will get 
RED as the result. GET returns NIL if 
the atom does not have the indicated 
property on its property list. 

Earlier I mentioned that the LISP 
function CDR took a list as its argu- 
ment. CDR also can take an atom. The 
CDR of a literal atom is its property 
list. If you type (CDR 'BALL), you'll 
get (COLOR RED). The function REM 
removes properties from a p-list. Thus 
(REM 'BALL 'COLOR] removes the 
property COLOR from BALL'S p-list. 

What are p-lists good for? Suppose 
you want to create a dictionary of 
English words to be used by a natural 
language processor. The various proper- 
ties associated with a word, such as 
part of speech, plural form, etc., could 
be conveniently stored on a p-list. For 
example, the p-list for the atom APPLE 
could look like (NOUN T PLURAL 
APPLES OBJECT FRUIT SHAPE 
ROUND). These properties could be used 
by the natural language parser to deter- 
mine if a statement was syntactically 
correct and semantically meaningful. 

P-lists also are used to store func- 
tion definitions. LISP determines 
whether or not an atom is a function by 
checking the atom's p-list for the EXPR 
or SUBR property. If the function is an 
EXPR, the property value is the func- 
tion definition; if it's a SUBR, the prop- 
erty value is implementation- 
dependent (usually the address of the 



interpreter subroutine that evaluates 
the SUBR). One way to have a LISP 
function create other functions on the 
fly is by PUTting the function defini- 
tions on atom p-lists. 

There is still a great deal about LISP 
and its applications that are beyond the 
scope of an introductory article. Hope- 
fully, your curiosity is piqued enough 
to want to learn more about this unique 
and fascinating programming language. 
The P-LISP package, published by 
Gnosis, Inc., is a worthwhile invest- 
ment for those who own an Apple and 
want to become part of the world 
of LISP. 

References 

1. Allen, John, Anatomy of LISP, 
McGraw-Hill, 1978. 

2. Bagley, Steven and Shrager, Jeff, The 
P-LISP Tutorial, Gnosis, Inc., Phila- 
delphia, PA, 1982. 

3. Horn, B. and Winston, Patrick, 
LISP, Addison-Wesley, 1981. 

4. Siklossy, L., Let's Talk LISP, 
Prentice-Hall, 1976. 

5. Winston, Patrick, Artificial Intelli- 
gence, Addison-Wesley, 1977. 

You may contact the author at 1041 Penn 
Circle F-606, King of Prussia, PA 19406. 

JMCRO 



C64 FORTH 

for the 
Commodore 64 



Fifi.-Forth implementation including: 

• Full feature screen editor and assembler 

• Forth 79 Standard Commands with 
extensions 

• High resolution. 16 color character and 
sprite graphics 

• Full I/O allowing IEEE cartridge and Basic 
data file compability 

• Three voice tone and music synthesizer 

• Derailed manual wirh examples and 
BASIC-FORTH conversions 

• Trace feature for Debugging 

$99.95 - Disk Version 
(Works with 1540 or 1541 Disk) 
or Cassette Version 
(ODmmodore 64 is a trademark of Commodore) 

PERFORMANCE 
MICRO PRODUCTS 

770 Dedham Street, S-2 

Canton. MA 02021 

(617)828-1209 



No. 57 - February 1983 



MICRO 



69 



AMOK) 

New Publications 



Programming the PET/CBM, by Raeto 

Collin West. Compute! Books (625 
Fulton Street, P.O. Box 5406, Greens- 
boro, NC 27403), 1982, 504 pages, 
paperback. 
ISBN: 0-942386-04-3 $24.95 

The 68000: Principles and Program- 
ming, by Leo J. Scanlon. Howard W. 
Sams & Co., Inc. (4300 W. 62nd St., In- 
dianapolis, IN 46268], 1982, 238 pages, 
paperback. 
ISBN: 0-672-21853 $14.95 

Educational Software Directory: A Sub- 
ject Guide to Microcomputer Software, 

compiled by Marilyn J. Chartrand and 

Constance D. Williams. Libraries 

Unlimited (P.O. Box 263, Littleton, 

CO 80160-0263], 1982, 292 pages, 

paperback. 

ISBN: 0-87287-352-8 $22.50 



Collegiate Microcomputer, Quarterly 
Journal starting February, 1983. Contact 
Brian J. Winkel, Editor, Rose-Hulman 
Institute of Technology, Terre Haute, 
IN 47803 for subscription information. 

TRS-80 Color BASIC, by Bob Albrecht. 
John Wiley and Sons, Inc. (605 Third 
Ave., New York, NY 10158), 1982, 376 
pages, paperback. 
ISBN: 0-471-09644-X $9.95 

A Structured Approach to Pascal, by 

Billy K. Walker. Richard D. Irwin, Inc. 
(Homewood, IL 60430), 1983, 209 
pages, paperback. 
ISBN: 0-256-02827-3 $9.50 

Apple Files, by David Miller. Reston 
Publishing Co. [Reston, VA), 1982, 414 
pages, hard cover. 
ISBN: 0-8359-0192-0 $14.95 



So You Are Thinking About a Small 
Business Computer, 1982/83 Edition, 
by R.C. Canning and N.C, Leeper. 
Prentice Hall, Inc. (Englewood Cliffs, 
NT], 1982, 203 pages, paperback. 
ISBN: 0-13-823617-8 $10.95 

Teaching Computer Programming to 
Kids and Other Beginners, by Royal W. 
Van Horn. Sterling Swift Publishing 
Co. (1600 Fortview Rd., Austin, TX 
78704], 1982, 142 pages, paperback. 
ISBN: 0-88408-154-0 $9.95 

plus $1.45 S/H 

Software Blueprint and Examples, by 

Yaohan Chu. Lexington Books (D.C. 
Heath and Co., 125 Spring St., Lex- 
ington, MA 02173), 1982, 519 pages, 
hard cover. 

ISBN: 0-699-05329-5 $39.95 

iMCAO 



.TM 



PET/CBM 

SOFTWARE SELECT! 



8032 

DISPLAY 



OR 



4032 

DISPLAY 



FROM THE KEYBOARD OR PROGRAM 
NOW RUN WORD PRO 3 OR WORD PRO 4 

FROM THE SAME MACHINE 

Available for either 4000 or 8000 Series 

ALSO: 
For 2001 / 3000 Series Computers 

Operate these Models in a Full 8032 Like 

Display For Word Pro 4* 

and all other 80 Column Software 

All installation instructions included. 

EXECOM CORP. 

1901 Polaris Ave. 
Racine, Wl 53404 
Ph.414-632-1004 

PET/CBM a trademark of Commodore Business Machines 
*trademark of Professional Software, Inc. 



•••••••••••••••••••••••• 

niM + POWER 
COMPUTECH 



from 




Check the 
outstanding 
documenta- 
tion supplied 
with AIM65! 



Top quality power supply designed to Rockwell's specs for fully 
populated AIM65 — includes overvoltage protection, transient sup- 
pression, metal case and power cable: 

PSSBC-A (5V 2A Reg; 24V .5A Avg, 2.5A Peak, Unreg) ... "64.95 
Same but an extra AMP at 5 volts to drive your extra ijoards: 
PSSBC-3 (5V 3A Reg; 24V .5A Avg, 2.5A Peak, Unreg) .... '74.95 
The professional's choice in microcomputers: 

AIM65/1K RAM '429,95 BASIC (2 ROMS) '59.95 

AIM65/4K RAM '464,95 ASSEMBLER (1 ROM) '32.95 

FORTH {2 ROMS) '59.95. 

SAVE EVEN MORE ON COMBINATIONS 

AIM65/1K + PSSBC-A... '479.95 AiM65/4K + PSSBC-3 ...'524.95 
We gladly quote on all AIM65/40 and RM65 items as well. 

ORDERS: (714) 369-1084 

P.O. Box 20054 . Riverside, CA 92516 OHIB 
California residents add 6% sales tax MMiEM 



• ••••••••••••••••••••••■* 



70 



MICRO 



No. 57 - February 1983 



/MOK) 



PET Vet 



By Loren Wright 



Sound on the Commodore 64 

My December column (MICRO 55:54| 
covered the exciting graphics features 
of the Commodore 64, including sprites 
and high-resolution graphics. The 
Commodore 64 's sound includes many 
capabilities found only on dedicated 
synthesizers. In this column I explore 
the C64's sound features and then 
review some sound software. 

The Problems 

The sound capabilities of most com- 
puters, and even most add-on boards, 
are limited. Sounds programmed with 
these usually don't come close to their 
natural counterparts. It's not sur- 
prising, considering the way most com- 
puter sound is produced. 

According to the theories of a 
physicist named Fourier, all sounds can 
be constructed by combining sine 
waves (figure 1) of the right frequen- 
cies. Full-fledged synthesizers allow 
full control over how much of each sine 
wave is used. In addition, the phase of 
each can be varied. As a result, synthe- 
sizers can duplicate nearly any sound. 

How is music usually produced 
with home computers? On the PET and 
many others it is possible to set up a 
square wave on the CB2 line of a 6522 
(VIA) by using an internal timer and the 
serial shift register. A square wave 
sounds a bit like a clarinet. The VIC 
and Atari computers use more sophisti- 
cated systems, with special chips par- 
tially dedicated to music. 

Musical sounds are usually com- 
posed of a single, fundamental fre- 
quency that determines the pitch of the 
note, and various amounts of the har- 
monics, or multiples, of the funda- 
mental frequency. For instance, a 
triangle wave consists only of odd har- 
monics, each in a proportion deter- 
mined by the reciprocal of the square of 
its harmonic number. Therefore, a 



triangle wave is dominated by the 
fundamental, with the third harmonic 
only 1/9 as loud, the fifth only 1/25 as 
loud, and the other odd harmonics 
much softer. It is difficult to produce a 
sine wave with inexpensive digital cir- 
cuitry. The more attainable triangle 
waveform looks and sounds similar to 
the sine wave, and although you can 
certainly hear the difference, it is a 
satisfactory replacement. 

The Commodore 64 has three 
voices, each of which can be pro- 
grammed with a triangle, rectangular, 
sawtooth, or random noise waveform, 
shown in figure 2. The rectangular 
wave's pulse width is programmable. 
The 6581 (or SID) chip has a great 
number of other capabilities, including 
filtration, synchronization, and ring 
modulation, which I'll discuss later. 

The Envelope Please 

Natural sounds seldom start im- 
mediately with their full volume, nor 
do they end abruptly. Think of the 
way they are produced. With a piano, a 
little hammer hits a string; with a 
violin, the hairs of the bow catch the 
string; with a wind instrument, the im- 
pact of the player's tongue starts the 
sound. How can a computer simulate 




Figure 1: Sine Wave 



the natural variations of volume within 
a single note? 

Most computers don't. The Com- 
modore 64 and real synthesizers use 
what is called an envelope for each note 
(see figure 3). There are four com- 
ponents of the envelope: attack, decay, 
sustain, and release. Attack is the time 
it takes for the note to increase from no 
volume to its maximum volume. 
Decay is the time it takes the volume 
to decrease to the sustain level, which 
is maintained for most of the duration 
of the note. Finally, release is the time 
it takes to go from the sustain volume 
level to silence again. 

The shape of the envelope can be 
programmed. The durations of the at- 
tack, decay, and release portions can 
each be programmed to sixteen dif- 
ferent values. The volume level of the 
sustain portion can be set to sixteen dif- 
ferent proportions of the peak volume. 
There is a gate bit for each voice. When 
this bit is set to 1 the attack begins, 
followed by the decay and the sustain, 
where it stays until the gate bit is reset 
to 0. Then the release portion of the 
envelope begins. 

This information is all you really 
need to know to use the 64 for simple 
music programming. Just select the fre- 
quency (this requires two POKEs), the 
waveform, the envelope parameters, 
and the overall volume. Then set the 
gate bit, leave it set for the length of the 
note, and reset the bit when the note is 
done. Multiple voice music is a matter 
of doing things in the right order and at 
the right times. Actual programming is 
a bit more complicated since individual 
bits must be changed without disturb- 
ing the others. 

Filters 

An audio filter functions in a way 
analogous to a paper coffee filter. The 
paper filter has little holes that will let 
the coffee pass through, but not the 
grounds. Make the holes a little bigger, 
and some of the finer grounds will pass 
through. The audio filter acts on fre- 
quencies and there are two basic kinds 



No. 57 - February 1983 



MICRO 



71 



of filters: low-pass and bigb-pass. A 
low-pass filter allows low-frequency 
waves to pass through, while the higher- 
frequency waves are blocked to a con- 
siderable extent. A high-pass filter re- 
jects low-frequency waves and allows 
high-frequency waves to pass. The 
borderline is called the cutoff fie- 
quency. The C64's SID chip allows ap- 
plication of bigb-pass, low-pass, band- 
pass (rejects high and low), or any com- 
bination of the three. The cutoff fre- 
quency and resonance, or sharpness, of 
the filter can be selected. However, 
there is only one filter unit, which can 
be switched in or out for each voice, so 
you can't filter the voices differently. 

If you set the cutoff frequency 
somewhere above the fundamental fre- 
quency and apply the filter in the low- 
pass mode, you will get a purer sound- 
ing, though softer, tone. The filter can 
also be applied in the high-pass mode to 
increase the harmonics, while atten- 
uating (i.e., reducing the volume) of 
the fundamental. 

Synchtonization and 
Ring Modulation 

These sophisticated controls can be 
used to produce complex waveforms. 
Syncbionizatioii causes the voice to 
lock onto thf frequency of another 
voice. Voice 1 syncs with voice 3, voice 
2 with voice ' , and voice 3 with voice 
2. Dependin.^: on the two frequencies, 
interesting effects can be produced. 

Ring modulation is the result of ad- 
ding and subtracting two waveforms. 
When ring modulation is on for a par- 
ticular voice, its output is the result of 
modulating from another oscillator. 
Non-harmonic frequencies (i.e., not 
multiples of the fundamental fre- 
quency) result, and very strange sovmds 
can be produced. As its name implies, 
this can also be used to produce bell or 
chime effects. Voice 1 is modulated by 
voice 3, voice 2 by voice 1, and voice 3 
by voice 1. 

Voice 3 has extra controls available. 
Its output can be turned off — useful for 
synchronization and ring modulation 
used on voice 1 when you don't want to 
hear the driving frequency. In addition, 
the oscillator and envelope generator 
outputs are available in digital form in 
two SID registers. When random noise 
is selected as the waveform for voice 3, 
the oscillator output is a very good 
source of random numbers. 

The sound output is available in a 
form compatible with good sound 



systems, so you don't have to rely on 
your TV's poorer system. 

Ptogtamming C64's Sound 

It is difficult for the BASIC pro- 
grammer to take full advantage of all 
the SID's capabilities. Even such sim- 
ple things as setting the gate bits re- 
quire ANDing and ORing. Machine 
language is more effective when some 
of the more sophisticated features are 
involved. 

In MICRO'S Commodore 64 Data 
Sheet (MICRO 55:109) most of the 
SID's registers were inadvertently 
omitted. See page 9 in this issue for a 
complete list. 

The Commodoie 64 User's Guide 
and the Piogiammei's Reference Guide 
include a number of sample programs 
that demonstrate most of the C64's 
music capabilities. The software 
developer's kit I mentioned last month 



F/0ure 2a: Triangle Wave 



includes a SID monitor and a fancy 
music program. The monitor allows 
you to change the contents of just 
about every SID register, while you 
listen to the result. The music program 
has a number of pre-programmed 
pieces, from "Magic Trumpet" to a 
Bach chorale. You can select an "in- 
strument" for each voice, the tempo, 
and a few other parameters. As the 
music plays, the tune is displayed as 
notes on a clef. The part of the program 
that lets you compose your own music 
is not very good. The notes are keyed in 
by their alphabetic representations. 
This might be OK for copying sheet 
music, but it's not very good for the 
trial-and-error composing most of us 
are likely to do. Abacus Software's 
"Synthy-64," reviewed below, makes 
programming of multi-voice music a 
lot easier. 

A third type of music program is in- 



Flgure 2b: Sawtooth Wave 




r\ f] 



r\ 



n 



A 



r\ 



a) 



\j 



Figure 2c: Pulsed (rectangular) Wave 



W 



Figure 2d: Noise Waveform 



72 



MICRO 



No. 57 - February 1983 



teractive — one that allows you to play 
music in real time. The "Piano Key- 
board" program in the user's manual is 
an example. It is impressive for what it 
does, but its limitations soon become 
apparent. Only one note can be played 
at a time. That's because the GET func- 
tion can only read one key at a time. 
Also, it's easy to get ahead of the 
BASIC program. The effect is flattering 
for someone with uncoordinated 
fingers — the notes come out evenly 
spaced — but for others it is frustrating. 
A more complete interactive music 
program requires machine language for 
speed and should read the keyboard 
matrix to detect more than one key 
down at a time. Throw in a real 
musical keyboard, perhaps interfaced 
through the controller and parallel 
ports, and you would have something 
resembling a real synthesizer. Consider 
it a challenge! 

Synthy-64: 

A Music Composition Program 

Abacus Software's "Synthy-64" by 
Roy Wainwright is a music composi- 
tion program that is considerably easier 
to use than the Commodore program 
described above, and a lot easier than 
figuring out all the POKEs yourself. 
Users familiar with musical notation 
will find Synthy-64's notation easy to 
grasp. Notes are entered with their 
alphabetic representations, followed by 
the octave number, a slash, and a 
number indicating the length (I for 
whole, 2 for half, etc.). Octave 
numbers and durations remain the 
same, until changed, so shorthand 
notations can be used. Flats, sharps, 
naturals, key signatures, dotted notes, 
double-dotted notes, triplets, repeats, 
and rests are all easy to use. A sample 
program line is shown below. 

10 SGN%2 B5/8 C/16 D E F G A6 B/2 

Tempo and volume can be changed 
at any point during the composition. 
You can also program a "portamento" 
as if it were a regular musical note. A 
portamento is a continuous sweep, up 
or down, in the pitch of a note. The rate 
of sweep can be selected with a 
multiplier parameter. 

The three voices are indicated with 
+ , - , and £ prefixes. As with octaves 
and note durations, these designations 
are inherited by the next note, unless 
otherwise changed. The Synthy-64 in- 
terpreter has a read ahead feature that 




Figure 3: Envelope 



SUSTAIN 




TIME 



makes it easy to keep the three voices 
synchronized. There is no way to in- 
dicate measvires, but this can be done 
by adopting the convention of using 
separate lines for each measuie. 

That's all you really need to do 
some impressive three-part composing. 
The attack, decay, sustain, release, 
waveform, filters, etc., are set up with 
default values that produce a piano-like 
sound. In addition, the skeleton pro- 
gram includes convenient subroutines 
for flute, trumpet, banjo, accordian, 
and piano sounds. All of these registers, 
as well as ring modulation and synchro- 
nization, can be controlled with simple 
commands to set up your own sounds. 

Synthy-64 is an interpreter that 
replaces the C64's BASIC interpreter, 
so most BASIC keywords don't work or 
work differently. The rudiments are 
there for control of program flow: 
GOTO, GOSUB, RETURN, STOP, 
END. The INPUT command is 
modified to handle multiple choice 
menus like a BASIC ON... GOTO. 
Text, including all C64 control and 
graphics characters, can be displayed 
simply by enclosing the characters in 
quotes. Just about everything else is 
missing, including the POKE state- 
ment needed to change screen or border 
colors jit works in immediate mode, 
but not within a program). LOAD and 
SAVE operations are implemented for 
both cassette and disk. 

I found only two minor bugs in 
Synthy-64. The manual says you can 
tie a portamento to the previous note. 
My attempts to do this resulted in the 
interpreter skipping the portamento. 
Also described is a "skip ending" 
feature to repeat a phrase, skipping the 
rest of the program line, until a 



specified number of repeats have occur- 
red. Instead, the remainder of the line 
is played the specified number of 
repeats, and then it is skipped — 
backwards! Synthy-64 changes octave 
designations between G and A, rather 
than the more conventional C split. 

The manual is an adequate refer- 
ence, although there are numerous 
typographical errors, a few of which 
result in misinformation. 

Synthy-64 is, in general, a well- 
done, convenient music composition 
program. Nearly all of the C64's power- 
ful sound features can be exploited. 
It is available for $35 from Abacus 
Software, P.O. Box 7211, Grand 
Rapids, MI 49510. 

MICRO'S VIC BOOK 
Available in March 

I am currently editing, writing, and 
programming for MICRO'S VIC book, 
to be released in March. Unlike most of 
MICRO'S articles, the content will be 
aimed at the newcomer — the person 
who is just beginning to realize there is 
more to computing than running canned 
software. Eight or more useful and 
entertaining programs will be included 
on cassette and listed in the book, as 
well. The text that accompanies each 
program will aim first at using the pro- 
gram, then at making improvements by 
changing lines, and finally at 
understanding how the program works. 

The most exciting program is one I 
call "MICRO Calc." MICRO Calc 
allows you to define elaborate mathe- 
matical calculations, make convenient 
changes, and calculate the results at the 
touch of a key. Screens can be saved on 
tape for future use. In addition the pro- 
gram can be used to learn how BASIC 
expressions work. 

JMCRO 



No. 57 - February 1983 



MICRO 



73 



68000 Program Control: 
Branch and Jump Instructions 



by Joe Hootman 



The 68000 installment this 
month covers the branch and 
jump Instructions, both 
conditional and unconditional. 

Branch and jump instructions allow the 
transfer of program control to another 
portion of the program. There are two 
basic types of program control instruc- 
tions: the unconditional jump/branch 
and the conditional' jump/branch. 
Table 1 catalogues the unconditional 
program control statements, and table 
2 contains the conditional program 
control statements. 

There are three basic types of uncon- 
ditional program control instructions 
(table 1). The first type is the branch 
always (BRA) and jump (JMP). The 
BRA instruction branches with either 
an 8-bit or 16-bit displacement from 
the existing program counter contents. 
The JMP instruction jumps to an effec- 
tive address expressed in the opword. 

The BRA and JMP instructions do 
not save any return address informa- 
tion. If you want to return to the in- 
struction following an unconditional 
branch, then you must Branch to Sub- 
routine (BSR) or Jump to Subroutine 
(JSRj. Both the BSR and JSR store the 
next instruction address on the stack 
before the next instruction is executed. 
The BSR instruction uses a specified 
displacement to designate the next in- 
struction and the JSR instruction 
calculates an effective address to locate 
the next instruction to be executed. 

The last type of unconditional 
branch is the Return and Restore CCR 
[RTR] and Return from Subroutine 
(RTS]. These instructions are used at 
the end of a subroutine to return pro- 
gram control to the main program. A 
return is used when you want to con- 
tinue execution at the original program 
location. When RTR is used, both the 
program counter and the CCR are 



Table 1: Program Control Branch and Jump Instructions 

Mnemonic Dau Size/CCR Name Comments 



BRA 



8, 16 

(offset 

displacement! 

CCR 

XNZVC 



Branch 
Always 



The program will always continue executing at 
the PC + displacement. The displacement is 
either 8 or 16 bits and is in two's complement 
form, the displacement is measured in the 
number of bytes. 



Opworc 

15 14 13 12 11 10 9 8 


Format 

7 6 5 4 3 2 10 


110 


8-bit displacement 


16-bit displacement 



The 16-bit displacement is zero if the 8-bit 
displacement is used. 



BSR 



8, 16 


Branch to 


(offset 


Subroutine 


displacement) 




CCR 




XNZVC 





The address of the instruction immediately 
following BSR is stored on the system stack. 
The PC is loaded with PC + displacement. 
The offset displacement is either an 8-bit or 
16-bit displacement and is expressed in two's 
complement form 

Opword Format 
15 14 13 12 11 10 987654321 



1 10 1 



8-bit displacement 



16-bit displacement 



If the 8-bit displacement is zero, the 16-bit 
displacement must be used. Note a zero 
displacement cannot be used. 



IMP 



CCR 

XNZVC 



Jump 



The program will continue to execute at the 
address specified by the instruction. The address 
is specified by the addressing modes. 

Opword Format 

15 14 13 12 11 10 9 8765432 10 



10 1110 11 



Effective Address 
Mode I Register 



The effective address specifies the address of the 
next instruction. The following address modes 
cannot be used: 1, 2, 4, 5, 12, 13, 14.* 



JSR 



Jump to The address of the instruction immediately 

Subroutine following the JSR instruction is pushed onto 
the system stack and the program continues 
execution at the address specified. 

Opword Format 

15 14 13 12 1110 9 8 76543210 



CCR 
XNZVC 



10 1 1 10 10 



Effective Address 
Mode I Register 



The effective address mode specifies the location 
of the next location. The following address 
modes caimot be used: 1, 2, 4, 5, 12, 13, 14.* 

(continued) 



74 



MICRO 



No. 57 - February 1983 



Table 1 (continued) 
Mnemonic Data Size/CCR Name 



Comments 



RTR 



CCR 

XNZ VC 
pulled fiom 
stack 



Return and The PC and CCR are pulled from the stack and 

Restore restored. 

Condition 

Codes Opword Format 

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 



010011100 1110111 



RTS 



CCR 
XNZ VC 



Return from The PC is puUed from the stack and the previous 
Subroutine value of the PC is lost. 

Opword Format 

IS 14 13 12 11 10 9 8 7 6 5 4 3 2 1 



10 1110 1110 10 1 



TAS 



8 

CCR 

XNZVC 
-..00 



Test and 
Set an 
Operand 



The TAS instruction sets N if the most 
significant bit of the data is set, and cleans N 
otherwise. The Z bit is set if the data is zero. 

Opword Format 



IS 14 13 12 11 10 9 8 7 6 


5 4 3 2 10 


10 10 10 11 


Effective Address 
Mode 1 Register 



The following address modes cannot be used: 2, 
10, 11, 12, 13,14.' 



•Addressing modes will be covered in future issues. 



Table 2: Program Control Instruction (with tests) 

Mnemonic Data Size/CCR Name Comments 



BCC 



8, 16 

(offset 

displacement] 

CCR 

XNZVC 



Branch 
Condition- 
ally 



If the specified conditions of the CC table 
are met, the PC will be loaded with the PC + 
[offset) and the execution of the program 
continued. The offset is specified in two's 
complement form, either 8 or 16 bits. 
Opword Format 



15 14 13 12 11 10 9 8 


7 6 5 4 3 2 10 


110 


Condition 


8-bit displacement 


16-bit displacement 



The 8-bit displacement is the two's complement 
specifying the relative distance between the 
branch and the instruction that is to be branched 
to. If the 8-bit displacement is zero, the 16rbit 
displacement is used. 



DBCC 



16 


Test 


(offset 


Condition 


displacement! 


Decrement 


CCR 


and 


XNZVC 


Branch 



If the specified condition of the CC table for 
the loop is not true, the low order 16 bits 
of the counter data register are decremented 
by one. If the result is - 1, the execution 
continues with the next instruction. If the result 
is not — 1, execution continues at the current PC 
+ the sign extended 16-bit offset displacement. 
The PC is the current instruction plus 2. 

Opword Format 

15 14 13 111110 9 8 7 6 5 4 3 110 



10 1 


Condition 


1 1 1 


Register 


displacement 



The condition field is specified by the 16 bits in 

the CC Uble. 

The register field specifies the data register 

which is the counter. 

The displacement field specifies the distance of 

the branch. 

(continued) 



pulled from the stack. When RTS is 
used, only the progam counter is pulled 
from the stack. 

The Test and Set an Operand (TAS) 
is designed to control the access of the 
68000 to shared RAM. The TAS in- 
struction is a read/modify/write in- 
struction and tests the data to see if the 
most significant bit is set. The byte of 
data is returned to memory with the 
most significant bit set. The TAS is 
designed to allocate RAM to multiple 
users. If one of the multiple users 
wants to use a portion of RAM, he first 
reads the "TAS bit." If the most 
significant bit is set, the user knows 
that memory immediately adjacent to 
the TAS is being used. If a TAS byte has 
a zero in the most significant bit posi- 
tion, the user knows memory is avail- 
able for use. The most significant bit is 
then set on the TAS byte and returned 
to memory to indicate that the memory 
immediately adjacent to that TAS is be- 
ing used. 

The conditional transfer of control 
from one part of a program to another is 
accomplished by testing one or more of 
the bits in the CCR. The conditional 
branches are given in table 2. The 
branch conditional instruction tests 
the bits in the CCR in accord with the 
CC table and branches if the conditions 
are met. The branch displacement is 
expressed as a two's complement 8-bit 
or 16-bit offset. If the 8-bit displace- 
ment is zero, the 16-bit displacement is 
used; if the 16-bit displacement is zero, 
the 8-bit displacement is used. 

The Test Condition Decrement and 
Branch (DBCC) instruction is useful 
because it will count the number of 
times a specified condition in the CCR 
is not true. One of the data registers is 
used as a counter, and when the value 
in that register reaches - 1, the instruc- 
tion immediately following the DBCC 
instruction is executed. DBCC is 
useful for implementing a loop while a 
condition is true in the CCR. 

The Set According to Conditions 
(SCC) is an instruction that tests the 
particular bits in CCR and sets the byte 
specified by the EA. If the condition is 
not true, the byte is set to zero. 



No. 57 - February 1983 



MICRO 



75 



STATISTICS 

PURE AND SIMPLE 




Human Systems Dynamics progFoms offer you 
flexibility, accuracy, and ease of use. You can 
purchase from the HSD atatistica specialists 
with complete confidence. Any program that 
doesn't suit your needs can be returned within 
10 days for full refund. 



NEW 



STATS PLUS 



$200.00 



Complete General Statistics Package 

Research Data Base Management 

Design and Restructure Your Files 

Count, Search, Sort. Review/Edit 

Add, Delete, Merge Files 

Compute Data Fields, Create Subfiles 

Interface with other HSD programs 

Produce Hi Res bargraphs, plots 

1-5 way Crosstabulation 

Descriptive Statistics for all Fields 

Chi-Square, Fisher Exact, Signed Ranks 

Mann-Whitney, Kruskai-Wallis, Rank Sum 

Friedman Anova by Ranks 

10 Data Transformations 

Frequency Distribution 

Correlation Matrix, 2 way Anova 

r, Rho, Tau, Partial Correlation 

3 Variable Regression, 3 t-Tests 



ANOVA II 



$150.00 



Complete Analysis of Variance Package 
Analysis ofCovariance, Randomized Designs 
Repeated measures Designs, Split Plot Designs 
1 to 5 Factors. 2 to 12 Levels Per Factor 
Equal N or Unequal N. Anova Table 
Descriptive Statistics, Marginal Means 
Cell Sums of Squares, Data File Creation 
Data Review/Edit, Data Transformations 
File Combinations, All Interactions Tested 
High Resolution Mean Plots, Bargraphs 



HSD REGRESS 



$99.95 



Complete Multiple Regression Analysis 
Up to 25 Variables, 300 Cases/Variable 
Correlation Matrices, Descriptive Statistics 
Predicted & Residual Scores, File Creation 
Regression on Any Subset of Variables 
Regression on Any Order of Variables 
Hi-Res Scatterplot & Residual Plot 
Keyboard or Disk Data Input 
Case X Case Variable x Variable Input 

Apple II, 48K 1 or 2 Disk Drives 
3.3. DOS, ROM Applesoft 

Call (213) 993-8536 to Order 

or Write: 
HUMAN SYSTEMS DYNAMICS 
9249 Reseda Blvd., Suite 107 
^^—Northridge, CA 91324^ 
V/SA 



Table 2 (continued) 














Mnemonic Data Size/CCR 


Name 


Comments 


sec 8 




Set 


The specified condition of the CC table is tested. 


CCR 




According 


[f the specified condition is true, the byte 


XNZVC 


to 


specified by the £A is set to all ones, 




- 


Condition 


otherwise the byte is set to all zeros. 










Opword Format 








15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 


10 1 Condition 


1 1 


Effective Address 














Mode 1 Register 


The condition field is specified by one of the 16 








codes given by the CC table. 








The effective address field specifies the location 








of the T/F byte. The following address modes 








cannot be used: 2, 10, 11, 12, 13, 14.* 


CC Table 








Name 


Code 


CCR Tested 


Name Code CCR Tested 


CC Cairy Clear 


0100 


C 


LS Low or same 0011 C + Z 


CS Carry Set 


0101 


C 


•LT Less than 1101 NV + NV 


EQ Equal 


0111 


z 


MI Minus 1011 N 


•GE Greater or equal 


1100 


N-V + N-V 


NE Not equal 0110 Z 


•GT Greater 


1110 


NVZ + NVZ PL Plus 1010 N 1 


HI High 


0010 


CZ 


•VC Overflow clear 1000 V 


•LE Less or equal 


uu 


Z + N-V + NV 


•VS Overflow set 1001 V 


••F False 


0001 





••T True 0000 1 






* Conditions used with two's complement arithmetic. 






* * These tests are used for SCC, DBCC only. 








JMCfX>- 




C COMPILERS-COMMON FEATURES: 

• UNIX VER 7 compatibility • standard lioat, double, and lonj support • run time library with full I/O 

and source • fast compilation and execution * full languasc. 

AZTEC C II CP/M (MP/M) $199 

• produces relocatable 8080 source code • assembler and iinlcer supplied • optional M80 interface • 

SID/ZSID debusser interface • library utility • APPLE requires Z80 and 16K card 

AZTEC C 1 1 APPLE DOS $199 

• relocatins assembler supplied • APPLE SHELL • VED editor • library and other utilities 

• requires 16K card 

C86 IBM PC MSDOS CP/M.86 $249 
• directly produces 8088/8086 object code • iinlcer supplied 

Manuals-S30 ORDER BY PHONE OR BY MAIL-Specify products and disk format 



MANX 

software systems 
Box 55, Shrewsbury, N.J. 07701 (201) 780-4004 



CP/M FORAAATS: 8' STO HEATH, APPLE, OSBORNE, NORTHSTAR, OUTSIDE USA-Add S10 In N J add 5% sales tax 



76 



MICRO 



No. 57 - February 1983 



f ,1 






ling like it before. Notliing else iilte it now! 



. . brings you continuous Hi-Res action-animation in every adven- 
turous moment! And, real running, leaping, crawling. Real fighting, 
shooting, stabbing, dynamiting. Real wounding, poisoning, 
killing. Real action, excitement, mystery! All in a real-time 
challenging adventure that's the wave of the future! 

Vy^ Paul Stevenson's graphic genius, first displayed in liis 

\ffi, J ; best selling "Swashbuckler" sword fighting ganne, 

y! ■ ' '^%t- outdoes itself in AZTEC. You're inside an ancient 

^ 'I Aztec pyramid searching for the golden idol. 

Descend deep into the heart of the temple— 

' meet cobras, scorpions, giant lizards, 

f hostile Aztec guardians and more. Watch 

for hidden trapdoors and strange death- 
rooms. Be ready to fight, or run, crawl or 
jump to possible safety. The menace is 
real, the options and strategy are yours. 
You've never seen an adventure like 
Aztec! You'll never tire of its amazing 
action-animation and exciting challenge. 
'y- $39.95forthe Appleir Atyour 

computer store or: 






r f «^^ 






^.J^^/\.- 









k^^p-^m'--^-^ 



ozycroft Ave., Chatsworth, Ca 91311 . (21 



''M-'"*-^ 






^ 




^.^,^^', 



'^m'^L 



lASTERCARD accepted 



! tl is a trademark of Apple Computer, 



More on Tiny PILOT 
for the PET 



by Arthur Hunkins 



The author's observations 
include how to solve a few tricky 
problems, more detailed 
explanations of some 
commands, and how to convert 
the program for 8K PET. 

As an educator, I appreciate PILOT as a 
simple, instructionally oriented, first 
language. Therefore, I was fascinated 
by the article, "Tiny PILOT for the 
PET" (MICRO 49:73), by Jim Strasma 
and John O'Hare. Since this PILOT re- 
quired only 2K of memory, I couldn't 
wait to code it into my Upgrade 8K PET. 

I quickly discovered, however, that 
Strasma and O'Hare's code was for 32K 
PET/CBM. Many changes are required 
to convert it to 8K. The modification, 
though time-consuming, is straight- 
forward and easy to explain. It involves 
changing all numbers in the range 
$78-$7F to the range $18-$1F, and 
beginning the code at $1800. Excep- 
tions to the number changes are these: 
do not change a number in the range of 
$78-$7F if it is followed immediately 
by a second number in the same range 
— change only the second number. For 
an example see the Tiny PILOT listing 
(MICRO 49:75]: leave the value in 
$7846 as is and change the one in 
$7847. Also, three other locations 
should not be changed: $78AD, $7838, 
and $7F2E. That's it for the coding 
changes. 

The initialization sequence for the 
8K version becomes NEW:SYS7936 
($1F00 instead of $7F00J. To run 
PILOT programs, do SYS6145, or use 
the ordinary RUN command. 

This relocated Tiny PILOT runs on 
any PET/CBM with Upgrade ROMs 
and 8K or more of memory. The 6K not 
used by PILOT should be adequate for 
most PILOT programs. For the excep- 
tional case, the conversion instructions 



above permit tailoring Tiny PILOT to 
any size memory on a 4K boundary. For 
example: on a 16K PET, convert 
$78-$7F to $38-$3F (with the excep- 
tions mentioned), start coding at 
$3800, and initialize at $3F00. 

The initialization routine protects 
PILOT one page lower than necessary 
in high memory, reserving 2.25K in- 
stead of 2K. If you need the additional 
page, change $7F10 and $7F11 (or 
$1F10 and $1F11 in the 8K adaptation) 
to $EA (NOP). You may alternately 
POKE7952,234 and POKE7953,234 in 
the 8K version or, after initializing, 
simply POKE53,24. 

To understand Tiny PILOT better, 
the reader should consult the article 
containing the original Tiny PILOT, 
upon which Strasma and O'Hare based 
their version for the PET. "Tiny 
PILOT: An Educational Language for 
the 6502," by Nicholas Vrtis (MICRO 
16:41), offers substantial and lucid 
details of user operation and internal 
programming logic. 

One of the attractive features in the 
new implementation is the incorpora- 
tion of graphics and cursor control 
features into the screen display,- e.g., 
RVS field, CLR screen, and placement 
of text or graphics anywhere on the 
screen. In addition, there are special 
statements that reverse the field of 
everything currently displayed, and 
that scroll the screen up or down. The 
statements D: (Delay) and W: (Wait) 
also are particularly relevant to the in- 
structional environment. Such educa- 
tionally meaningful features in a 2K 
package are unique indeed.' Tiny 
PILOT'S statements are both highly 
practical and readily comprehended by 
the young computerist. 

There are other user-oriented 
features. Hitting RETURN in response 
to I:, ?:, or A: statements gives either 



zero or a null string; it does not knock 
you out of the program as does BASIC'S 
INPUT (press STOP to exit the pro- 
gram). Also, L:G-Z, unimplemented 
subroutines that might inadvertently 
find their way into a program, return 
appropriate ERROR messages — they 
do not bomb leaving the user buried in 
a machine-language crash. 

Special challenges occur when you 
attempt to deal with string variables in 
Tiny PILOT. The language's greatest 
limitation — and the one that saves the 
most memory — is a near lack of string 
variable capability. (Some modest addi- 
tional capacity in this area would be 
most welcome.) As it stands, the only 
viable string variable applications 
involve matching responses, and incor- 
porating the user name string and 
strings converted from numerics in 
text. The only directly specified string, 
the name string $?, is entered by the 
user in response to a ?: statement. It is 
later referenced in Match and Type 
statements. 

Numerics may be included in text 
only by first converting them into 
strings. This is accomplished with the 
Compute statement, C:$ = N, where N 
is a previously defined numeric vari- 
able (see Sample Program, MICRO 
49:74). The same conversion is re- 
quired for Match, as matching is done 
only on text strings. Thus, 20, 2/5 and 
"2gether" all match with 2. This 
feature is awkward when the intent is 
to match numbers. One solution, again 
illustrated in the Sample Program is to 
subtract the numbers from one another, 
convert the result to a string, then 
Match to zero. In PILOT code these are: 
C:R = A-B, C:$ = R, M:0, where A and 
B are the numbers being compared. 

There are two important omissions 
in the list of PET Tiny PILOT Program 
Statements (MICRO 49:73). E:, listed 



78 



MICRO 



No. 57 - February 1983 



in the original Vrtis article but absent 
here, is an Exit from Subroutine used in 
conjunction with U: (Use Subroutine). 
The combination of U: and E: gives 
PILOT a highly viable subroutine 
capability. (By the way, E:, in contrast 
to BASIC'S RETURN, is simply ignored 
when not executing a subroutine — a 
useful feature in some situations.) 

The other error is in the fourth Pro- 
gram Statement: TEXT should read 
M:TEXT. This line describes the 
Match statement (also clarified by 
Vrtis). Note that, as mentioned above. 
Match operates only on text, and that 
multiple Matches are allowed per state- 
ment (commas separating the Match 
items). The Match option M: - checks 
for a negative "number" — evidently a 
minus sign as the first character. M: -i- 
is not implemented, but would be a wel- 
come and memory-efficient addition. 

You should be aware of several little 
quirks in the operation of Jump and Use 
Subroutine statements. With J:A (Jump 
to last Accept), you get an ERROR 
message if you attempt to jump back 
out of a subroutine you previously 



jumped into. J:A works fine as long as it 
is not inside a subroutine. Also be sure 
to reserve J: A for jumping to the last en- 
countered A: (Accept) statement. "A" 
is a reserved label and any use of "A" 
as an ordinary label will result in an ER- 
ROR message. The referenced A: state- 
ment must already have been en- 
countered in the program,- jumping 
ahead to A: is not possible. Note, too, 
that U:A (Use Subroutine starting at 
last Accept) is not dependable. Such a 
branch can be accomplished by giving 
the Accept statement a regular label 
(such as *ZA:), and referencing it (U:Z). 
I would like to suggest two addi- 
tional enhancements to Tiny PILOT. 
First, since the P: statement generates 
only random integers from 1-99, get- 
ting random numbers in any other 
range is cumbersome (though possible). 
An optional extension to the routine, 
specifying a different range (for exam- 
ple, P:X,7 for a 1-7 span), would 
simplify coding. Second, a numerical 
Match statement (with positive and 
negative compare) also would help 
compact code. 



In any case, if you have a PET/CBM 
with Upgrade ROMs, try Tiny PILOT. 
It's a most worthwhile educational in- 
vestment, especially for the young com- 
puterist just beginning to program. And 
it won't cost you anything but time. 



Editoi's Note: "Tiny Pilot for PET" 
was published as object code only. 
Those wishing to have this program for 
4.0 BASIC may want to obtain the 
source code from: 

ASM/TED Users' Group 

c/o Brent Anderson 

200 S. Century St. 

Rantoul, IL 61866 



Arthur B. Hunkins may be contacted at 
the School of Music, UNC-G, Greensboro, 
NC 27412. 

/IMCftO 



•■"•CQiiJPU 5Ef\j5Ei:.' 

CENTIPOD $27.95 
Like Centiped, only better! 

FROGEE $27.95 
The exciting arcade game of Frogger. 

MOTOR MOUSE $29.95 
What a cheese'ee game! 

CRIBBAGE 

VIC-20 $14.95 C-64 $17.95 

This is the game of Cribbage. 

STAR TREK 

VIC-20 $12.95 C-64 $17.95 

Excellent adventure game! 

MASTER MIND 

VIC-20 $12.95 C-64 $19.95 

Makes you think. 

ROACH MOTEL $9.95 
Kill the bugs! 

YAHTZEE1.1 $12.95 
YAHTZEE2.1 $14.95 

GENERAL LEDGER $19.95 

(VIC-20) 

CHECK MINDER 
VIC-20 $19.95 C-64 $24.95 

HOME INVENTORY $19.95 

(VIC-20) 

TO ORDER 
P O BOX 18765 
WICHITA, KS 67218 
(3161 684-4660 



Personal checks accepted 
(Allow 3 weeks) or 
CO D (Add $2 00) 
Handling charges S2 00 
VIC-20' IS a registered trademark of Commodore 



VIC-20 USERS: Get Serious With A PRQiriQJEEOI 



• A cartridge development system | 

• Program from Commodore 
VIC-20 keyboard into built-in 4K| 
ROM emulator 

• Jumper to target ROM socket 

• Test programs in circuit 

• Built-in EPROM programmer 
and power supply 

• Burns & runs EPROMS for the 
Commodore VIC-20, too 

• Comprehensive manuals 

• Fits EXPANSION PORT 

• Includes Hexkit 1.(3f, a powerful 100% machine code editor/de- 
bugger utility program that makes coding for 8-bit Micros a snap. 

Programs 2716, 2732, 2732A, 27C16, 27C32, adaptable to 2532 & 2764 

PRQIYIOLIEEIVI CARTRIDGE COMPLETE ONLY $199 




GLQUCESTEH 
C^IYIPLJTEH,ll>^c. 

One Blackburn Center 
Gloucester, MA 01930 
617-283-7719 

Send for Free Brochure 



^»^ 







No. 57 ■ February 1983 



MICRO 



79 



%] 



ELECTRONICS, INC. 

COPYRIGHT © 1981 - PATENTS PENDING 

566 Irelan, Buellton, CA 93427 
(805)688-2047 

8:00 TO 5:00 CALIFORNIA TIME 



SUPER FAN II 

FOR YOUR APPLE 11 * COMPUTER 



COMPUTER PRODUCTS 

DESIGNING • MANUFACTURING 
ELECTRONIC ENGINEERING 



TM 




One Year Warranfy 

$74.95 

With Zcncr Ray™ 
Protection $109.00 

MASTERCARD - VISA 



"COOL IT" 




TWO EXTRA 

120 VOLT OUTLETS 



• ALSO FITS ON APPLE'S* NEW MONITOR STAND 

• RED PILOT LIGHT ON/OFF SYSTEM SWITCH 

• CLIPS ON - NO HOLES OR SCREWS • REPLACEABLE SWITCH 

• AVAILABLE IN 120V or 240V AND 50/60 HZ • DURABLE MOTOR 

• REDUCES HEAT CAUSED BY EXTRA PLUG-IN CARDS 

• SOLD WORLD WIDE • UNIQUE 1 YEAR WARRANTY 

• TAN OR BLACK COLOR • QUIETEST FAN ON THE MARKET "^^^^"^^^■^^"■^^■" 

• INCREASED RELIABILITY — SAVES DOWN TIME AND REPAIR CHARGES 

• LOW NOISE DUE TO DRAWING EFFECT OF AIR THROUGH YOUR COMPUTER AND SPECIAL FAN AND MOTOR DESIGN 

• TWO EXTRA 120V OUTLETS FOR MONITOR AND ACCESSORIES TURN ON WHEN YOU TURN ON YOUR FAN 
(NOT AVAILABLE ON 240V MODEL) 

SUPER FAN II™ WITH ZENER RAY OPTION $109.00 

ZENER RAY"^ TRANSIENT VOLTAGE SUPPRESSOR 

OUR BUILT IN ADVANCED DESIGN UNIT GIVES 

DRAMATIC COST SAVINGS — STOPS ANNOYING DOWN TIME 

INSURANCE FROM VOLTAGE SPIKES - GLITCHES 

DANGEROUS VOLTAGE SPIKES CAN JEOPARDIZE YOUR COMPUTER SYSTEMS 

PROTECT COMPUTER - DISK DRIVE - PRINTER AND MONITOR 

NO CUTTING WIRES • WON'T VOID WARRANTY, JUST PLUG IN SUPERFAN II WITH ZENER RAY 

OTHER PRODUCTS BY % rELECTRONics. inc. 

SUPER RAM II™ 16K RAM CARD FOR YOUR APPLE 11. 2 YEAR WARRANTY $125 

GUARDIAN ANGEL™ AN uninterruptable power source $595 

12 VOLT TRANSVERTER12 VOLT - RUNS YOUR APPLE II COMPUTER AND 

AND 51/4' DRIVE FROM YOUR CIGARETTE LIGHTER $149 

•Registered trademarks of Apple Computer Inc. npAi PQ IKIf^lllRIPQ IKII/ITPR 



80 



MICRO 



No. 57 - February 1983 



A BASIC Match Routine 

for CAI 



by Robert Phillips 



Using a match routine, CAI 
authors can effectively trap 
errors, isolate mistakes, and 
overlook typographical errors. 
This article discusses some 
uses for a match routine, and 
presents such a routine in 
BASIC. 

MATCH 

requires: 

A Microsoft BASIC 

One of the nice things about a com- 
puter is its unfailing accuracy; yet one 
of the frustrating things about a com- 
puter is that same compulsive accuracy 
— it can't even recognize a simple 
typographical error. But users in- 
evitably make typographical errors; 
also, they may make responses to ques- 
tions in a program that the author 
didn't anticipate, such as "sure" in- 
stead of "yes." The programmer must 
try to overcome these problems. When 
he asks a "yes/no" question, for exam- 
ple, he may test the first letter of the 
response and if it is a 'Y' he can assume 
the answer is affirmative. He can use a 
statement such as 

IF LEFT$(A$,1) = 'Y' THEN GOTO 999 

and have the program branch ap- 
propriately, regardless of the answer 
(YES, Y, YEP, YEAH, etc.). However, 
when designing teaching materials for 
CAI (Computer- Assisted Instruction), 
the programmer may find himself fac- 
ing difficulties because of typographical 
errors and misspellings. He must find a 
way to determine if the response 
matches what he is looking for. The 
purpose of this article is to show some 
ways in which a "match" routine can 
be used to write CAI effectively, and to 
present my MATCH algorithm, writ- 
ten in Applesoft and adaptable to most 
dialects of BASIC). 



The Match Routine 

Originally I wrote this algorithm in 
PL/ 1 for use on an IBM 360. Since I 
knew it worked there, I translated it 
from PL/1 into BASIC, rather than 
starting from scratch in BASIC. Some 
of the logic shows its PL/ 1 parentage. I 
followed IBM's method of using the 
match facility ("Partial Answer Pro- 
cessing") in their CAI language 
Coursewriter (the " • " will not match a 
blank character). 

Since Applesoft BASIC does not 
have a built-in index or position func- 
tion, I use the MID$ function to scan 
the string for the items to be matched. 
When an asterisk is found, its position 



is noted, and then it is replaced by a 
slash (/) in both the author's string and 
the student's response. This replace- 
ment effectively masks the character to 
be ignored by making it identical in 
both strings. Note that it is necessary 
to find the sections separated by amper- 
sands before masking with the aster- 
isks; yet, the asterisk means to ignore a 
character. This is the most difficult 
part of the algorithm. (For a completely 
different way of attacking this problem, 
see the discussion on a match algo- 
rithm in the publication Fiontend from 
CONDUIT, University of Iowa.) 

Take a closer look at how the rou- 
tine works. There are four possibilities: 



Listing 1 THE MATCH ROUTINE 

100 REM)) MATCH ALGORITHM <( 

102 R : 0: IF St = At THEN R < 1 RETURN 

104 FOR Zl = 1 TO LEN <At):IF MI D« < At , Z 1 , 1 ) = "S" THEN GOTO 112 

lOi NEXT Zl: Z2 : 1: Zl : 0: Zlt < Alt: Z2« :: St: COSUB 1S4 

lOB ZS = LEN(Zlt): IF MI Dl ( Z 1 t , 1 , ZS ) > MI Dl ( Z2 I , 1 , ZS ) AND LEN<Z2t) ^ ZS THEN 

R = 1 
110 RETURN 

112 Za =0: IF Zl = 1 THEN At > MIDt(At,2l GOTO 120 
114 Z3I > LEFTt (At ,Z1.1 ) : Z4t : LEFTt ( S t , Z 1 - 1 ) : Zlt = Z3I Z2I =: Z4I GOSUB 

1S4 
lU IF Zlt <) Z2t THEN RETURN 
11) At : MIOt (At ,ZU1 ) : St = MIOt(St,ZUl) 
120 FOR Zl = 1 TO lEN(At): IF MI Dt ( At , Z 1 , 1 ) = "$" THEN Z3t = 

MIDt (At , 1 ,Z1-1) : GOTO 126 
122 NEXT Zl: Zl = 0: IF lEN(At) = THEN R = 1 : RETURN 
124 Zl > 0: Z3t > At: At :: "" 

12i FOR Z4 « 1 TO lEN(Z3t); IF MI Dt ( Z3 t , Z4 , 1 ) • "•" THEN GO TO 138 
128 NEXT Z4: Z4 < 0: Z« . Zl - 1 IF Zl > THEN li ^ LENCZJt) 



No. 57 - February 1983 



MICRO 



1. there are no masking characters; 2. 
the only masking character is ' • '; 3. the 
only masking character is '&.'; or 4. 
both '•' and '&' are used as masking 
characters. The first two possibilities 
(no mask or only asterisk) are easy to 
check. First I check (line 102) to see if 
A$ and S$ are equal. If they aren't, line 
104 looks for the position of the first 
ampersand., If none is found, line 106 
invokes the asterisk mask subroutine 
in line 154. If any asterisks are present, 
they are masked there. When the sub- 
routine returns to line 108, Zl$ and 
Z2$ are the masked versions of A$ and 
S$. They are tested for equality,- if they 
are equal, R is set to 1 . The match rou- 
tine then returns. (You do not need to 
set R = 0; you do that when you enter 
the match routine, and set R = 1 only 
just before a RETURN. That way the 
"default" at return is 0.) 

Lines 154-166 are the "asterisk sub- 
routine," used to mask an asterisk. Z2 
is a switch to skip line 156, which 
deletes leading blanks,- this is necessary 
when ampersands are used also. Line 
158 finds the position of the asterisk. If 
none is found, the subroutine returns. 
Line 162 checks to be sure that it is a 
non-blank character. If it is a blank, 
you know that the match has failed. 
You don't need to return to the match 
routine, so POP the calling address in- 
side the match routine and RETURN to 
where the match routine was invoked. 

If the character is not blank, lines 
164-166 replace the asterisk with '/'in 
A$, put a slash in the same position in 
S$, and then go back to line 158 to find 
any other asterisks. If not, it RETURNS 
to the line that called it. The choice of 
the slash as the mask was purely arbi- 
trary. I felt that it was unlikely to occur 
in things my students write. You can 
change it to something else, such as a 
control character or a non-printing 
character; e.g., CHR$(92), the 
backslash. 

As I plaimed the match routine, I 
realized that the best way for me to pro- 
ceed was to compare from the front to 
the first ampersand, make a new string 
starting after the ampersand, and com- 
pare to the next ampersand, etc. If any 
section cannot be found, the match has 
failed and the routine returns 0. 

To make things as clear as possible, 
in the following discussion I call each 
part a 'segment.' I define segment as 
any part of A$ between two amper- 
sands, or between the begirming and 



Listing 1 fContiaued) 



130 Z9 := LEN(Z3$); FOR Z7 = 1 TO LEN(S»)-Z'»1 IF MI D ! ( S , Z7 , Z 9 ) = Z3! THEN 

GOTO 134 
132 NEXT Z7: RETURN 
134 If Z7 ( Z8 THEN RETURN 
134 Ze = Z7: GOTO 152 

138 Z5« = LEfT$(Z3l,Z4-l) : Z4 = Z4 - 1: Z7 = 1 
140 Z? • LEN<Z5$): FOR Z7 . Z7 TO LEN<S1)-Z9: IF Ml D8 ( S I , Z 7 , Z 9 1 « Z5S THEN 

GOTO 144 
142 NEXT Z7: RETURN 
144 IF Z7 ( ZB THEN RETURN 
144 Z8 = Z7; Z4 = Zl - 1; Z4» = MI D» ( S $ , Z7 , Z4 ) : Z2 • 0: ZU = Z3S: Z2! = 

Z4»: GOSUB 154: IF ZIJ <) Z2« THEN Z7 = Z7 + I GOTO 140 
148 25 = LEN(Z1$): IF MI D» ( 2 U , 1 , Z3 ) = MI D$ < Z2 « , 1 , Z5 ) AND LEN(Z2!) < = Z5 + 

1 THEN GOTO 132 
150 RETURN 

132 AS : HIDS(AS ,ZU1 ) 
154 IF Z2 = THEN GOTO 15S 

134 IFLEfT$(ZJ$,l) > " " THEN Z2» - M1DI(Z2I,2) GOTO 154 
158 FOR Z3 . 1 TO LENIZIJ): IF MI D$ ( Z 1 $ , Z3 , 1 ) = "•" THEN GOTO 142 
140 NEXTZ3: RETURN 

142 IF MID$(ZJ»,Z3 , 1 ) « " " THEN POP; RETURN 
144 21$ = mD«(Zl$, 1 ,Z3-1 ) + "/" + MID$ (Zl» ,Z3+1 ) 
144 Z2S s niDS(Z2S , 1 ,Z3-1 ) -f "/" * MI DS < Z2 S , Z3 + 1 ) : GOTO 138 



the first ampersand, or between the last 
ampersand and the end of the string. If 
a segment has one or more asterisks in 
it, I call each part separated by the 
asterisks a "subsegment." Thus, if 
A$ = "& MAN & WOMAN &", there 
are two segments ("MAN" and 
WOMAN"). It is the same if 
A$ = "MAN & WOMAN". If A$ = "& 
MAN & WOM»N &" then there are 
two segments, with the second con- 
sisting of two subsegments. When an 
ampersand is detected in A$, the 
routine works with these segments, 
trying to find each one. Naturally, if at 
any time the search for a segment fails, 
the routine does a RETURN. 

Line 104 finds the location of the 
first ampersand and goes to line 112. If 
the ampersand is the first character in 
the string, there is nothing in front of it 
to check, so line 112 strips off the 
ampersand and goes to line 120. If the 
ampersand is not the first character, 
line 114 substrings off the first segment 
from both A$ and S$; these segments 



are assigned to both Zl$, Z3$ and to 
Z2$,7A$, respectively. The routine 
then invokes the asterisk function with 
GOSUB 154. (Here you want any leading 
blanks stripped off, so you must turn 
off switch Z2.) After the asterisk mask 
has been applied, the substrings Zl$ 
and Z2$ are compared in line 116. If 
they are not equal, the match has failed 
and the routine does a RETURN. 

If the first segment is successful, 
line 118 discards the first segment (and 
the ampersand) from A$ and S$. The 
program then checks (line 120) for the 
position of the next ampersand. If it 
finds one, control passes to line 126. If 
it doesn't, check the length of A$. If 
there's nothing left in it, it means 
you've checked the entire response 
without doing a RETURN; the match 
has been successful, so R = 1 and you 
RETURN. If there is still more of A$ 
left, it means that this is the last seg- 
ment and it didn't end in an amper- 
sand, so you have to look for an aster- 
isk (line 126). 



82 



MICRO 



No. 57 - February 1983 



Listing 2 to invoke and test the match routine 




10 HOME: VTAB 1: PRINT TAB (i), "MATCH ROUTINE INPUT ALGORITHM" 


PRINT: 


PRINT TAB(»)i "(USING BASIC ROUTINE)": VTAB 12 




20 PRINT; INPUT "INPUT 'AUTHOR' STRING --> ";A»: IF NOT LEN(A») 


THEN At < 


0L»: GOTO 50 




30 TEIT: VTAB 8: CALL -»58: PRINT "A» = • " ; A»; : POKE 34,10 


HOME 


10 0L» = A»: ir A» = "END" THEN TEIT: HOME: VTAB 21: END 




30 PRINT: INPUT "'STUDENT' STRING --> "; S«: S« = " " + S« + " 


• 


60 GOSUBIOO: PRINT: IF NOT R THEN PRINT "NO "; 




70 PRINT "MATCH": PRINT: GOTO 20 





The coding that starts on line 126 
checks any segment that had an amper- 
sand in front of it. This means you have 
to ignore as much of S$ as necessary to 
find the segment specified in A$. Before 
you scan for the whole segment, how- 
ever, determine if there are any aster- 
isks present and, if so, mask them. If 
line 126 finds an asterisk, the program 
goes to line 138. Here, S$ is scanned 
(line 140) for the substring in front of 
the asterisk. If it is not found, line 142 
does a RETURN with no match. Line 
144 checks to make sure that the seg- 
ment found is in the string later than 
the last segment found. If both of these 
are OK, then the program substrings off 
the entire segment (this is easy: since 
asterisks represent one byte, you know 
how long the segment is and can use a 
MID$ to get the entire segmentj. You 
then GOSUB to tlie asterisk subrou- 
tine. If that doesn't match, it does not 
necessarily mean that there is no 
match; it means that you must scan 
further to see if you can find another 
occurrence of the subsegment in front 
of the asterisk. To do this, line 146 
does a GOTO 140. If you get to line 
148, it means you have found the right 
segment and have masked the aster- 
isks. Check it. If it is good, go back to 
line 120 to find the next segment; if the 
comparison is false, you don't have a 
match, and so you RETURN. 

Please note that there are lots of 
string operations in this routine, and 
string operations create garbage. If 
there are hundreds of string variables 
(as in an array, for example) in a large 
program that uses lots of memory, 
memory will need to be cleaned quite 
often, which may consume a consider- 



able amount of time. In most circum- 
stances, however, this should not pre- 
sent a problem. 

If you are interested in developing 
uses for this routine, I suggest you use a 
very short program to get the strings 
called A$ and S$, and see if it accurately 
reports match/no match. Listing 2 is 
just such a short test program. You can 
put it in front of the Match routine to 
test it. In this test program, if you want 
to use the same author string again, 
press return without entering anything. 
To end, simply enter 'END' as the 
author string. Try it with represen- 
tative samples to see if it is accurate 
and fast enough for your purposes. 



Limitations and Modifications 

When using this match routine in 
my programs, I have found no cases of 
the routine reporting incorrect results. 
However, experimentation has shown 
that the routine will give an incorrect 
result if a word with an asterisk in it is 
repeated and separated by ampersands, 
such as 

&GRE*N &GRE*N & 

This will report a match if it finds just 
one occurrence of the string. If the 
items are separated, such as 

& GRE*N & MACHINE & GRE*N & 

it always reports no match. These prob- 
lems are caused by the need to check 
that the segments are in the right order. 
They are the only limitations in the 
algorithm of which I am aware. There 
may be others. 



As indicated above, I followed the 
lead of IBM's Coursewriter in not 
allowing the asterisk to mask a blank. 
If you would like the asterisk to ignore 
a blank as well as any other character, 
change statement 162 to REM. 

When items are separated by the 
ampersand, they must be in the order 
that they appear in A$. If order is unim- 
portant, so that 

& COMPUTER & MACHINE & 

should give a match no matter which 
order the two words are in, change 
statements 134 and 144 to REM. I have 
not tested the accuracy of all possible 
combinations when lines 134, 144, and 
162 are all chanaged to REM. 

Uses for the Match Routine 

There are various types of CAI. One 
is "drill and practice," in which the 
student is given quick, rapid-fire drill 
on items that have one right answer. 
Another type is called "tutorial," 
which serves as a tutor to the student, 
giving practice but also supplying ex- 
planations to the student. If the CAI 
program is to act as an effective tutor 
rather than a drill-master, it is 
necessary to identify student errors and 
diagnose them. Diagnostics explain the 
specific error to the student so he can 
understand the error, learn from it, and 
— hopefully — not repeat it. 

The author who designs materials 
with diagnostics has two basic choices 
for formatting the student's response: 
some type of "objective" (or "con- 
trolled") questions, such as true/false, 
multiple choice, yes/no, etc.; or some 
type of open-ended (or "non- 
controlled") item. The controlled type 
is comparatively easy to program, 
although it does take time and care to 
develop effective materials. But some 
types of teaching activities simply can- 
not be done by a controlled-question 
format. As a foreign-language teacher, 
for example, I want my students to use 
the language forms actively, rather 
than merely to identify the correct 
form in a controlled format. 

With non-controlled items, a stu- 
dent may be asked a question to which 
he responds with a sentence. It is im- 
possible for an author to predict every 
possible variation of vocabulary, ex- 
pression, and spelling that the student 
might use in his answer. Most CAI pro- 
grams scan the answer, looking for a 
key word or two. If the student has used 



No. 57 - February 1983 



MICRO 



83 



those words, the answer is considered 
correct. For this reason, all the CAI 
languages with which I am familiar have 
some type of facility that enables the 
author to scan the student response. 

What a Match Routine Does 

A match routine can be used for 
several purposes: to scan for a key-word 
or key phrase, to overlook misspell- 
ings, and to detect what type of error a 
student has made, which is necessary 
for effective diagnostics. To do these 
things, the author must be able to tell 
the routine what to look for and what 
to ignore (selective ignoring or masking 
is what a match routine is all about]. I 
use two characters (as in IBM's Course- 
writer): the asterisk and the ampersand. 
The asterisk ('»') indicates a "single- 
character ignore;" that is, when scan- 
ning to see if the student's response 
matches the author's expectations, the 
routine ignores the character in the 
position of the asterisk. Thus, if the 
author asks to match COMPUT»R, the 
routine reports a match if the student 
response is "computer" or 
"computor" or "computir" or even 
"computzr". Because the asterisk ig- 
nores only non-blank characters, a 
response such as "comput r" will yield 



a no match. The ampersand ("&'), 
which is a "multiple-character 
ignore," means ignore anything and 
everything (or even nothing!) in that 
position. It works just like the 'wild- 
card' character ' = ' used in some utility 
programs, such as FID. Thus, an in- 
struction such as 

& COMPUTER & 

tells the routine to report a match if it 
finds the word "computer" anywhere 
in the response. 

The asterisk and ampersand can be 
used together so that an instruction 
such as 

& COMPUT*R & 

returns a match if it finds the word 
"computer" or "computor" or "com- 
putir" or even "computzr" anywhere 
in the student response. Note that the 
placement of the ampersands may be 
crucial. If there is not an ampersand at 
the beginning, the word must be the 
first word in the response, since the 
routine is not instructed to ignore 
anything in front of the first word. 
Similarly, if there is no ampersand at 
the end, the word will have to be the 



last! Several different words can be 
used, separated by ampersands: 

& COMPUTER & MACHINE & 

will give a match only if the student 
uses both words and in that order. 
Some things that match are "The com- 
puter is a useful machine," "My com- 
puter is bigger than a sewing 
machine," etc. However, "A com- 
puting machine" would give a no 
match ('computer' is not there) as 
would "That machine is my 
computer" (the words are out of order). 
Figure 1 shows more examples of 
strings that match or don't match. 

One use for a match routine is to 
find a key word or a key phrase. To do 
this, the author puts the key word or 
key phrase between ampersands. If it is 
important that they be stand-alone 
words, rather than parts of words, there 
must be a space between the amper- 
sands and the word; if not, then the 
ampersands should not be separated. 

A second use for a match routine is 
to be able to ignore misspellings and 
typographical errors. To do this, the 
author may substitute the asterisk for 
the letter(s) most likely to be misspelled. 
Or, the author can use the ampersand 



ACORN 68666 



AHACHED 

PROCESSOR 

FOR THE 

APPLE M™ 




$1495 



HARDWARE 

• 68000 Microcomputer with 12 MHZ clock 

• 131,072 Bytes of RAM Memon/ 

• 32,768 Bytes of ROM Memon/ 

• Two RS 232c serial ports up to 19,200 bps 

• One million bps interface with APPLE™ 

• Seven levels of vectored interrupts 

• Real time clock and timer 

• Separate case and power supply 

• Uses only one periphe.'ol slot in the APPLE™ 

• Invisible operation with APPLESOR or PASCAL 

• Compatible with Compilers and 6502 Assembly 
Programs 

• 68000 Assembly Language Development System 
Write or call for a free brochure or send $10 for 100 page 

users manual (refunded with order for ACORN) 

ACORN SYSTEMS INC. 

4455 TORRANCE BLVD., #108 • TORRANCE, CA 90503 
Telephone (213) 371-6307 

'Apple. Apple H end Applesoft are the trodemarks of Apple Computer Co. 



^ 



32K CMOS STATIC RAM BOARD for SYM/AIM 

Models MB-132/32K, $299 
/16K $241, /8K $197 
Features: 

• 200ns Low Power CMOS, STATIC RAM 

• Extends your expansion connector 

• Plug compatible with 2716 EPROMS 

• First 8K are jurr.per selectable 

• Entire board may be bank-switched 

• G-10 Glass epoxy, Full solder mask. Gold fingers 

• Full 1 -year limited warranty 

I/O EXPANSION BOARD for the SYM/AIM 




l/OX-122 $60 
l/OX-222 $72 



and other mtcrocompuiers that use 6522 VIAstor I/O 
and do not provide full address decoding on board 
This board has physical space for four additional 6522 
VtAs. and provides additional decoding for a total of 
16 devices. Connectors for all I/O lines, and further 
expansion are included All 6522 functions are 
available, with no interference with previous 
functions of the original VIA Two versions of this 
board are available. The l/OX-1 22 mounts above, and 
directly plugs mto, an onboard 6522 socket, and 
refocates the ongtnat VIA (o the expansion board 
Where there are space limitations, the l/OX-222 
uses a dip header and an 8" cable for remote 
installation 



REAL-TIME CLOCK/ CALENDAR $60 Write for info 
P.O. Box 1019 • Whittier, CA 90609 • (213) 941-1383 





84 



MICRO 



No. 57 - February 1983 



to ignore several characters. Of course, 
the two can be used together. 

A third use for a match routine is to 
find out exactly where a student has 
made a mistake. In my opinion, the 
most effective CM does not merely tell 
the students that they have made a 
mistake, but it diagnoses the error; i.e., 
it tells them what they did wrong and 
offers an explanation. The only way an 
author can effectively diagnose errors is 
to know what the error is. Diagnosis is 
comparatively easy with controlled 
items; with non-controlled items it 
becomes more difficult — precisely 
when diagnosis is most important. 

This match routine is not very fast 
since it is in BASIC rather than 
machine language. Putting some 
Spanish CAI on my Apple, I found that 
it takes about 1.4 seconds to compare 
this author's string 

& LE DECIMOS & QUE & SE ACUESTE & 
(we tell him to go to bed) — put 

English translation here, please, author!) 



with this student response: "Nosotros 
le decimos a Juan que se acueste tem- 
prano' ' (We tell John to go to bed early) . 
That is not too long, but if the student 
makes some unanticipated mistake, it 
takes the program even longer to work 
its way through to find the error. (I 
have timed the program to take as long 
as five seconds in involved cases where 
the match routine must be invoked 
many times to analyze one sentence). 
To obscure this time lapse, at various 
stages I include progress messages such 
as "THE SENTENCE IS INCORRECT" 
when the right answer is not matched, 
"FIRST VERB IS CORRECT" as the 
checking continues, etc. The length of 
time is urmoticeable since the process- 
ing is completed before the student 
finishes reading the messages. 



Linking the Match Routine 
To a Piogiam 

I use the match algorithm as a 



Figure 1: Examples of "Match" 


and "No Match" 




A$ 


S$ 


Match? 


& COMPUT.R & 


COMPUTER 


Yes 




COMPUl'lR 


Yes 




COMPUTING 


No 




COMPUTE OR DIE 


No 


& COMPUT& 


COMPUTER 


Yes 




COMPUTE OR DIE 


Yes 




COMPUTING MACHINE 


Yes 


& GREEN & 


GREEN FIELDS 


Yes 




GREENSLEEVES 


No 




GREAT SPLEEN 


No 


& GRE*N & 


GREEN BEANS 


Yes 




A GREEN AND RED COLOR 


Yes 




IT IS GREAN 


Yes 




GRAIN 


No 


&GR&N& 


GREEN FIELDS 


Yes 




GREENSLEEVES 


No 




GREAT SPLEEN 


Yes 




GROWN MAN 


Yes 




GROANING 


No 


&HOW& 


I DON'T KNOW HOW TO DO IT 


Yes 




HE WENT TO THE SHOW 


Yes 




MITCH OWES ME MONEY 


No 


&B.T& 


BYTE 


Yes 




BIT 


Yes 




BOUGHT 


No 




I BAT THIRD 


Yes 


& COMPUT& MACHINE & 


A COMPL) TING MACHINE 


Yes 




A COMPUl'ER OR A MACHINE 


Yes 




THE MACHINE IS A COMPUIER 


No 




COMPU TING MACHINERY 


No 




COMPUIE THE COST OF THE 






MACHINE 


Yes 



subroutine in my BASIC programs, ac- 
cessing it with a GOSUB. I start it on 
line 100 (see the Match Routine), ex- 
tending it to line 166. (My input 
routine with pre-processor is the only 
thing earlier in the program. Since both 
are accessed frequently, I put them as 
close to the top as possible.) Because 
you cannot pass arguments, you must 
make assignment statements before 
the GOSUB statement. The routine ex- 
pects the string variable A$ (for 
'Author') to have the string to be 
matched; the variable S$ (for 'Student') 
is assigned the student response (after 
pre-processing eliminates punctuation, 
compresses double blanks, and puts a 
blank at each end). I usually combine 
everything on one line: 



A$ = "&KNI*ES&" 
GOSUB100 



S$ = IN$: 



The match routine reports the result 
via the variable R; R = if there is no 
match, R = 1 if there is, and destroys 
the strings A$ and S$ during process- 
ing. The match routine needs to use in- 
termediate strings, and some index and 
pointer variables. The following 
variable names are used: Zl, Z2, Z3, 
Z4, Z5, Z6, Z7, Z8, Z9, Zl$, Z2$, Z3$, 
Z4$, Z5$. Any values stored in these 
variables when the match routine is in- 
voked may well be destroyed. 

Conclusion 

In applications where users will be 
responding with words and phrases, a 
routine that masks part of the input 
often is necessary to analyze that input. 
The routine may scan for key words, 
overlook spelling and typographical er- 
rors, or find exactly where an error oc- 
curs. For whatever purpose, the two 
masking characters (the asterisk and 
the ampersand) enable the author to 
use and analyze verbal input in- 
telligently to achieve the intended 
results. This match routine is one tool 
that can be used to do that. 

Robert Phillips has B.A., M.A., and Ph.D. 
degrees in Spanish. He is a professor at 
Miami University, Ohio, and is Assistant 
Chairman of the Department of Spanish 
and Portuguese. He has been working with 
Computer-Assisted Foreign Language 
Instruction since 1970 and has written 
CAI in PL/1, FORTRAN, APL, 
Coursewriter, and BASIC. You may 
contact Professor Phillips at the Dept. of 
Spanish and Portuguese, Miami 
University, Oxford, OH 45056. 

JNoao 



No. 57 - February 1983 



MICRO 



85 



An Overview of 
Educational Software 



by George Gerhold 



As a follow up to our October 
education issue, this article 
offers a discussion on 
specialized systems designed 
for educational applications. 

Educational software can be classified 
into three groups: applications software 
— programs designed to help the users 
(students) to master a particular body 
of material; general systems — stan- 
dard packages useful in an educational 
setting; and educational systems soft- 
ware — specialized languages and sys- 
tems designed for educational applica- 
tions. Our emphasis here will be on 
educational systems software. 

But let's begin with a few com- 
ments about applications software. 
There are vast amounts of such 
material in existence (something like 
10,000 hours worth for the PLATO 
system alone). Much of the applica- 
tions software for microcomputers is of 
very poor quality, much of it is hard to 
locate (it was written by a teacher for 
use in a particular classroom, and a 
half-hearted attempt at marketing was 
made), and most of it is poorly docu- 
mented. A number of publications and 
organizations have attempted to ad- 
dress these problems. The Microsoft 
Project (Northwest Regional Educa- 
tional Laboratory) is the most am- 
bitious attempt, in particular their ef- 
fort to establish a data base that lists 
sources and reviews. It appears that 
there is an obvious need for quality 
control via reviews, but there are many 
problems. Applications software is sup- 
posed to provide individualized in- 
struction, and what works well in one 
setting with one group of students and 
one teacher may fail in another setting. 
How does one review truly individua- 
lized material? 

Reading reviews of applications soft- 
ware is somewhat like reading reviews 
of recordings of contemporary classical 



music. Since there is no standard of ex- 
cellence for comparison, the reviews 
may tell more about the reviewer's bias 
than about the quality of the product. A 
number of institutions are trying to 
cope with the problem by assembling 
libraries for preview of programs. 

There are obvious problems with 
guaranteeing respect of copyright. Also, 
many of these institutions have spent 
their whole budget on hardware and are 
relying on donated software. We esti- 
mate that it will take close to 1,000 
such centers to adequately cover the 
country. No small supplier of software 
will be able to supply that number of 
free copies! A number of the textbook 
publishers have entered the educa- 
tional software field. Their products 
tend to place heavy emphasis on the 
most routine kinds of drill (heavy use 
of multiple choice or numerical 
answers) with elaborate record keep- 
ing. These programs are protected in 
ways that also prevent teachers from 
customizing them for their own class- 
rooms. Time will tell whether or not 
the publishers will find a way to com- 
bine their mass marketing approach 
with the individualization that charac- 
terizes the best educational applica- 
tions software. 

Next we turn to general systems 
software with educational applications. 
Word processing systems have obvious 
educational utility. Current practice in 
composition courses is to emphasize 
the rewriting/editing process as the 
part of composition that can be taught. 
There are a number of schools using 
word processing software in this way. 
One of the problems is that many of the 
word processing packages are designed 
for commercial use and as such are 
more complex than necessary for stu- 
dent use. A student version of Wordstar 
would be a worthwhile product. 
{Editor's note: Memory Bank has just 
released "The Bank Street Writer," a 
word processor for students.) Unfor- 



tunately, much of the hardware being 
purchased by schools is not ideal for 
word processing because of short lines 
and fuzzy characters. Data base man- 
agement systems could be widely used 
in schools, both in individual class- 
rooms and in central offices. Again, 
simplified versions of business systems 
should find a market here. At present 
there are a number of administrative 
packages on the market; for example, 
gradebook, attendance, and library 
packages. One of the most impressive 
is the Harts III package that, in addition 
to the items listed, also handles class 
scheduling for a large (1,000 students) 
school. Without doubt, the most widely 
used packages in this class are general 
language interpreters and compilers 
used in programming courses. One 
worthy of mention is the Interpas- 
RASCAL system, an interpretative ver- 
sion of Pascal plus a set of graphic and 
sound programs. This system comes 
with a complete cuniculum including 
textbooks and student and teachers' 
guides. It is cunently available from 
McGraw-Hill (Gregg Division) for the 
Apple n. No doubt other similar 
packages will appear shortly. One final 
item likely to find wide acceptance is 
the disk library management system 
for keeping track of programs. Disk 
Master for the Apple 11 is a fine example 
of this type of program. 

Finally we come to systems soft- 
ware designed specifically for educa- 
tional applications. Again this is con- 
veniently divided into three classes: 
programming languages, authoring lan- 
guages, and authoring systems. LOGO 
is really the only language designed for 
student programming. LOGO offers 
many advantages for this purpose. It is 
highly structured and allows long vari- 
able names and procedure names. It 
uses advanced techniques like recur- 
sion in an elementary and natural way. 
Above all, its orientation is primarily 
graphic, at least at the beginning levels. 



86 



MICRO 



No. 57 - February 1983 



Graphic exercises offer many advan- 
tages for use with beginners. The ap- 
peal is sufficient to hold their interest, 
and debugging is a visual process rather 
than an abstract reasoning process. For 
example, "the program went wrong 
after drawing four line segments" is 
much easier to detect than "the pro- 
gram gave this wrong numerical 
answer by going off after the fourth 
numerical step." 

LOGO is available for three dif- 
ferent microcomputer systems, with 
more rumored to be on the way. Three 
different sources offer versions for a 
64K Apple n with one disk; these ver- 
sions differ only in minor ways. Texas 
Instruments offers a ROM version for 
the 99/4 with memory expansion. 
Radio Shack offers b6th a ROM version 
(16K] and a disk version [32KJ for the 
Color Computer. There are significant 
differences between the three systems. 

The Apple versions are probably 
closest to the original mainframe ver- 
sions of LOGO. This is accomplished 
at the cost of speed, expensive hard- 
ware (remember 64KJ, and severe re- 
strictions on the amount of user pro- 
gram space. The Texas Instrument ver- 
sion adds more colors and sprites, 
which aid animation. This version of- 
fers only integer arithmetic and draws 



lines only by character definition, an 
approach that noticeably limits the 
complexity of figures that can be 
drawn. The Radio Shack version re- 
quires the least hardware and adds 
multiple turtles. This latter feature 
allows use of LOGO for illustration of 
true multi-tasking and other advanced 
concepts. It also provides a way for do- 
ing simple animation. The Radio Shack 
version offers only integer arithmetic 
and eliminates all of the word and list 
processing operations of the original 
LOGO language. These differences re- 
flect different analyses of what the 
educational applications of LOGO will 
finally be. Rumor indicates that there 
will be a sprite version for the Apple 
(requiring extra hardware) and a real 
number and line drawing version for 
the Texas Instrument. In considering 
LOGO as an educational tool remem- 
ber that it has been available for only 
one year. No doubt there will be many 
new applications of LOGO in the near 
future. 

Author languages are general com- 
puter languages designed to make the 
programming of instructional dialogs 
easier. Author languages reflect a dif- 
ferent set of priorities than more 
familiar computation languages like 
BASIC and Pascal. For example, an 



author language makes programming 
the recognition of keywords in a 
response relatively easy, even when 
those keywords are misspelled by the 
user, but an author language has little 
need for the nested loop construct 
essential in number-crunching applica- 
tions. Although there are a number of 
author languages for large computers, 
only PILOT has been implemented on a 
range of microcomputers. There are 
many versions of PILOT around, but 
the commercial products come from 
three sources. The original PILOT 
came from the San Francisco Medical 
Center. Nevada PILOT and Atari 
PILOT are close to the original version, 
but Atari PILOT has added turtle 
graphics to the package. A major set of 
additions to the original language were 
developed at Western Washington Uni- 
versity. Micropi offers versions based 
on those extensions for CP/M, 6809, 
TERAK, IBM, Pascal machines, and for 
a number of larger mainframes. Apple 
PILOT, TI PILOT, Monroe PILOT, 
Color PILOT (Radio Shack), and the 
forthcoming PILOT for the Com- 
modore 64 are all based on the Micropi 
version. IIAT offers a version of PILOT 
for CP/M machines. 

Author languages offer several ad- 
vantages for educational programming. 



UPGRADE YOUR AIM-65* INSTANTLY 



'A trademark of Rockwell Inc. 



To A 6809 Development System 

With The 

"MACH-9' 

From 

M M S Inc. 




INTRODUCTORY PRICE 

$239. 

Plus $6 U.P.S. 
And Handling 



Includes: 

*6809 CPU Plug-in Assembly 
"Super-set of AIM Monitor 
"Two-Pass Symbolic Assembler 
"Complete Monitor Source Listings 
"Enhanced Cut & Paste Editor 
"200 Page Manual 
"Full I/O Control 



MACH-9" is assembled and tested with 
local BUS, 5 locking low force ROM sockets 
and 2K Static RAM 

M M S Inc. 

1110 E. Pennsylvania St. 

Tucson, AZ 85714 

(602] 746-0418 




VISA- 



Programmer (or author) productivity is 
much higher when using author lan- 
guages. In fact programmer productivity 
when using a language like BASIC for 
such applications is often so low that 
they are forced to adopt multiple choice 
or numerical formats almost exclusively. 
Thus, a related benefit of using an 
author language is an increase in quality 
made possible by the increase in author 
productivity. Another advantage is that 
a flexible instructional program written 
in an author language is likely to be 
much more intelligible to teachers than 
the same program written in BASIC. 
This is important because the best 
educational software is imder revision 
— based on student reactions — for 
many cycles. Intelligible programs get 
revised and improved; others do not. 
One of the assumptions behind the 
PILOT language is that it is easier to 
teach an experienced teacher how to 
program using an author language than 
it is to teach a computer programmer 
how to design good instructional 
material. Experience has shown that 
this is true. Now the problem is to get 
the teachers enough free time to actu- 
ally do it! 

Authoring systems represent another 
attempt to make it easier for experi- 



enced teachers to generate instruc- 
tional software. Authoring systems pre- 
sent a menu of formats for instruction; 
for example, true-false, multiple- 
choice, and fill-in-the-blank. Once the 
teacher has selected the format, the 
authoring system builds the instruc- 
tional program from the teacher's 
responses to questions. Typically the 
authoring system would pose a series of 
questions like: what instructions do 
you want to give the student, what is 
the first question you want to ask the 
student, what is the correct answer, 
what response do you want to give to a 
correct answer, where should the stu- 
dent be sent after a correct answer, 
what is a common incorrect answer, 
etc. In some authoring systems the 
teacher's input is encoded into a file; in 
others the teacher's input actually 
generates a PILOT-like program. There 
are a variety of authoring systems on 
the market. All of them work on only 
one machine so there is no 
transferability possible. Without ques- 
tion the most elaborate is Bell and 
Howell's PAS system. PAS provides the 
widest range of formats and ways to in- 
clude true flexibility in answer process- 
ing, although the latter requires some- 
thing very close to programming. PAS 



also provides a variety of type styles 
and some graphics. PAS also carries 
what must be the record price for 
microcomputer software — $15,000 ed- 
ucational or $20,000 commercial, plus 
a healthy yearly fee. If I were the in- 
structor, I'd rather keep the money and 
leam to program! 

Finally we come to the area where 
educational software is weakest — 
graphic design. One problem is that the 
people writing educational software 
have no training in graphic design, so 
they tend to ignore it. The other prob- 
lem is that the software for graphic 
design included in most development 
packages is comparatively crude. Com- 
puter languages often draw on common 
knowledge to make learning computer 
languages easier. For example, many 
languages use an algebra-like syntax in 
numeric assignment. The problem is 
that we have no generally accepted lan- 
guage for graphics that can be trans- 
lated into computer terms. Both soft- 
ware and hardware (e.g., graphics 
tablets) solutions have been tried, but 
much remains to be done. The next de- 
velopment in educational software 
tools probably will be in the areas of 
graphics and speech generation. 

iMCftO 



^\m flRE flSSaCiflTES, LTD. 



MICRObits 



03 



tJ 



03 



Q-CQfd 

Questionnaire Analysis Software 



> Microcomputer based 

Avoid the expense of contract servicei - do everything in-house on 
your own Apple 11+ microcomputer. 

■ Easy dota entry 

Avoid time consuming keypunching. Uses respondent-marked cards 
entered with an Optical Mark Reader (keyboard entry also possible). 

• Comprehensive data analysis 

Sort on any variable(s), tally all responses, conduct cross tabs, 
correlations, lineor regression, frequency distributions, ond more. 

• Complete editing capabilities 

Weight items, derive composites, add or delete items, ond more. 

• Easy-to-use 

Programs ore user friendly, menu driven, and interactive. No special 
computer expertise is required. 



Coll or send for more inlormotion today. 

SCiEr^iTJI^iC SQI^TKJflfiE flSSQCiflTES, LTD. 

Bax eofi • Kiflusaj, vii. 5t.u3i 

TELEPHQI^E: (715) ai.5-5QE,E> 

Apple 11+ is a registered trademark of Apple Computer, Inc. 



Deadline for MICRObits: 20th of second month before 
publication; i.e., February 20th for April issue. Send type- 
written copy (40-word limit) with $25.00 per insertion. 
(Subscribers: first ad at $10.00.) 

Lessons In Algebra 

An easy and fun way to learn the basic elements of high 
school algebra. Apple computer diskette $29.95. 30-day 
money-back guarantee if not satisfied. 

George Earl 

1302 So. General McMullen Dr. 

San Antonio, TX 7 8237 

Dynamite PET/CBM Accessories! 

Write-protect switches/indicators for 2040/4040 disk 
drives. Real world software at low cost. 2114 RAM 
adapter (replaces obsolete 6550's) and 4K memory 
expansion for "old" 8K PETs. Hundreds of satisfied 
customers. Write for /iree catalog! 

Optimi2ed Data Systems 

Dept. M, Box 595 

Plafcentia, CA 92670 ^__^__ 



Double Precision Pascal 

TeraComp — A scientific mathematics library for Apple 
Pascal. Gives the Apple mainframe accuracy with 64-bit 
double-precision madiematics. Package includes matrix 
operations including inverse, double-precision 
trigonometric fimctions, and dynamic array allocation. 
$95.00 from: 

PicoTera Systems 

P.O. Box 1631 

Corvallis, OR 97339- 

(503} 754-0237 MJCRObltS continued on page 93 



MICRO 



No. 57 • February 1983 



Microcomputers in a College 
Teaching Laboratory, Part 4 

by Deborah Graves, Richard H. Heist, ThorOlsen, Howard Saitsburg 



Interfacing a microcomputer to 
two types of scientific 
instruments is described. These 
applications illustrate the 
importance of commonality in 
both hardware and software 
design. Interfacing a 
microcomputer to a scientific 
instrument can enhance the 
capabilities of the Instrument, 
as Illustrated with a 
spectrophotometer, or it can 
facilitate data reduction and 
increase productivity, as 
illustrated with a gas 
chromatograph. 

In Parts I - 111 of this series (MICRO 
53:53, 55:59, 56:38) we have described 
how the microcomputer is used for 
both data acquisition and process con- 
trol in the undergraduate chemical 
engineering laboratory. ^"^ So far we 
have concentrated on interfacing 
microcomputers directly to laboratory 
experiments and replacing conven- 
tional analog instrumentation with a 
combination of A/D converter, micro- 
computer, and printer — our universal 
instrument. 

A related area of application for the 
microcomputer involves interfacing to 
more sophisticated scientific in- 
struments. There are two primary 
reasons for using a computer with a 
scientific instrument. The first is to 
enhance the capability of the instru- 
ment, and the second is to improve 
operational features, such as ease and 
speed of operation and data reduction. 
The gas chromatograph and the spec- 
trophotometer are good candidates for 
microcomputer interfacing. Both find 
widespread application in chemistry 
and related fields, and all but the most 
expensive models require the user to 
spend a considerable amount of time 
reducing data. 



The Gas Chiomatogiaph 

One of the most widely used 
analytical tools is the gas chromato- 
graph [GC]. The chemical engineering 
department is no exception, as we 
make heavy use of the GC in both 
undergraduate and research labora- 
tories. In the imdergraduate laboratory, 
it is not uncommon for students to 
generate 15 to 20 chromatograms in an 
afternoon. Each of these must be 
analyzed and the data processed to 
reach the objective of the experiment. 
The data analysis can be quite tedious 
and time consuming. If a strip chart 
recorder is used to record the data, 
retention time and peak areas must be 
measured with conventional methods. 
Also, data reduction will generally be 
done outside the laboratory and usually 
too late to repeat any analyses that 
yield questionable results. These 
features of the laboratory are very un- 
attractive to the student and tend to 
obscure the important features of the 
experiments. 

These time-related problems have 
been eliminated by using the micro- 
computer to acquire and process the 
data from GC analyses on line. Data 
reduction that would normally require 
hours is now done in a matter of 
minutes. Consequently, oui students 
are now able to devote more of their 
time to the underlying conceptual 
aspects of the laboratory experiments. 

The hardware required to interface 
the microcomputer to the GC is sim- 
ple. The detector output is a voltage in 
the low millivolt range, similar to the 
output from thermocouples, as discussed 
in Part U of this series.^ Consequently, 
the A/D-convertei interface (QM-100 
and signal amplifier) used for tempera- 
ture measurements should be directly 
applicable. Initially oui chief concern 
was sampling speed since it is possible 
to get rapidly changing signals (narrow 



signal peaks) from the GC. However, 
the QM-100 A/D converter allows 
sampling rates up to 50 Hz, and this has 
proven to be more than adequate for all 
oior applications. The only remaining 
problem was to develop a computer 
program that would satisfy our needs 
and be easy for the students to use. 

The software package developed for 
the GC system consists of both 
machine-language and BASIC pro- 
grams. The machine-language program 
acquires and tests the data, and the 
BASIC program interacts with the user 
and performs data reduction. The user 
interface is designed to be friendly. The 
user doesn't need to be aware of the 
machine-language program since the 
BASIC program provides all instruc- 
tions necessary to operate the system, 
as well as a menu of available options 
for data output. A user does not need a 
computer backgrotmd to run the system. 

To operate the system, the user in- 
jects a sample into the GC and pro- 
duces a small pressure spike by 
momentarily interrupting the carrier 
gas flow. This spike produces a small 
output signal that causes the computer 
to begin the timing for the analysis and 
to look for incoming data. As the com- 
ponents of the sample pass over the 
detector, the computer stores the 
digitized signals and indicates to the 
user that it is accepting data. 

After the data acquisition is com- 
pleted, the user signals the computer to 
begin the data analysis. The program 
computes retention times and peak 
areas. If there is peak overlap the peak 
areas are resolved by dropping a per- 
pendicular between the two adjacent 
peaks. After a short time (10 to 60 
seconds, depending on the size of the 
data set) the user is queried as to which 
results he would like to see. One option 
is to display the spectrum, retention 
times, and peak areas on the computer 



No. 57 - February 1983 



MICRO 



89 



screen. Another is to generate high- 
resolution hard copy on a printer. The 
screen plot is generated using the 16 
PET/CBM graphic characters that com- 
bine quarter-cursor elements. The linear 
resolution of the screen plot is thus 
twice that obtainable by simply plotting 
with full size characters. The screen 
plot allows previewing of data prior to 
plotting on the printer. See figure 1 for 
examples of the printer output. 

The GC -microcomputer combina- 
tion has been used successfully for over 
two years and has had a significant im- 
pact on the laboratory program. It has 
provided a convenient method of data 
reduction and demonstrated the utility 
of the microcomputer as a laboratory 
tool. In addition, by streamlining the 
experiments that rely on the GC for 
chemical analyses, the microcomputer- 
GC system has improved our ability to 
handle large numbers of students in the 
laboratory program. This point has 
been most important since increased 
enrollments have had a profound im- 
pact on our laboratory operation. 

The Spectiophotometei 

Another important, commonly used 
analytical instrument is the spectro- 
photometer. Our department uses spec- 
trophotometers primarily as research 
tools, although they have been used in 
the undergraduate laboratories to a 
limited extent. 

The spectrophotometer presents the 
user with problems similar to those of 
the GC. The measxirement of an optical 
absorption spectrum produces a lot of 
information that must be aiialyzed and 
then converted to another form [such 
as absorbence, transmittance, or ex- 
tinction) to be of direct use. If the spec- 
tral scan covers a wide range of wave- 
lengths, data reduction can be quite 
time consuming. As with the GC, there 
are expensive accessories that will do 
most of the work, but these devices are 
not available in all laboratories and 
certainly not in most teaching 
laboratories. 

Most spectrophotometers use a 
photocell or a photomultiplier tube as a 
detection device, so the output signal is 
a current. Normally this is passed 
either to a chart recorder or a display of 
some sort, which converts the signal to 
a numeric representation. Since the out- 
put current of the detector can easily be 
converted to a voltage (see Part II of this 
series!, it is a simple matter to use the 
QM-100 A/D converter and an ampli- 



WTEi 

S>M>LE: 

CSNCNTS; 



RT< 1 
RT< 2 



>> 4S S. flC 1 

^ 57 S. (X 2 



' 481S 
< 2318 



SCaLEO SKCTfUti 
SCBLIN6 raCTOR- .85 



OHTE: 
COtCNTS: 



RT( 1 )« 34 S. (K 1 

RT( 2 ^ 48 S. (K 2 

RT< 3 )« 52 S. (K 3 

RT< 4 >» 75 S. «< 4 

SCALED SPECTRUM: 
SC«ILIH6 FOCTOR- 1.85 



1725 
1788 
2943 
1951 



Figure 1: High-resolution hard copy from two gas chromatography experiments. The 
first illustrates the chromatograph of a two-component mixture, and the second, a 
four-component mixture. The retention times and peak areas are Indicated at the top 
of each plot. The chromatograms were obtained with a Carle Model 8700 gas 
chromatograph Interfaced to a PET/CBM microcomputer and Trendcom 100 dot- 
matrix printer, as described In the text. 



fier to interface the spectrophotometer 
to the microcomputer. In this case, as 
with the GC, the hardware re- 
quirements are simple. The only sig- 
nificant problem was the development 
of the necessary software. 

The software requirements for data 
acquisition with a spectrophotometer- 
computer system are not very different 
from those already discussed for the 
GC. The computer must be signaled 
when data collection is to begin, and it 
has to store the acquired data for pro- 
cessing when the analytical scan is 
finished. It is necessary to keep track of 
the time and the wavelength scan rate 
so the wavelength scale can be cali- 
brated properly. Another requirement 
is that high-resolution hard copy of the 
absorption spectrum must be available 
for further analysis. 

The BASIC portion of the program 
package, which interfaces with the user 
and performs the calculations, was 
specific to this application and had to 
be written in its entirety. Because of 
the similarity in the requirements of 
the data acquisition routine, however, 
it was possible to modify the machine- 
language code from the GC program (by 
deleting parts specific to the GC and 
adding a few routines for handling the 
timing) and apply it to the spectro- 



photometer system. This commonality 
among applications in both software 
and hardware requirements is impor- 
tant. It occurs frequently, and recog- 
nizing it can save a great deal of time 
and effort. 

Since the spectrophotometer gener- 
ally scans a wavelength range during an 
analysis, it is important to coordinate 
the sampling rate and the wavelength 
scan rate. We chose to use a timer 
available on one of the input/output 
chips (6522) of the PET/ CBM com- 
puter. With this timer it is easy to 
measure time intervals precisely and 
have the microprocessor interrupted at 
the end of each interval so that it can 
sample the spectrophotometer output. 
By knowing the scan rate and keeping 
track of the number of sample points 
collected, the wavelength for each 
point can be determined. Once the 
computer has collected the data, absorb- 
ence or transmittance is easily calcu- 
lated. Details are available in the litera- 
ture concerning the PET/CBM input/ 
output ports"' 5 and the 6522.' 

One very significant advantage of 
this system over the use of a chart 
recorder is that the data can easily be 
stored, either internally or on an exter- 
nal mass storage device. Therefore, it is 
a simple matter to convert a single- 



90 



MICRO 



No. 57 • February 1983 



***** ***** 



m il 

SPECTRUM BESULTS 



DRTE: !e.'3e-S! 
SflHPLEi BENZENE UflPOR 
REFERENCE! filR 
CONCENTRBTION: 1 
PRTH LENSTH: : 
SLITS: 58 NICRONS 
Lor TYPE; DEUTERIUK 

PNT uoLTneei Tee 

OMItTER RflNBEi IBE-B? 
SCHH ROTE.- 3 flH6STR0MS/SEC. 
BES. GF SCflH! 2388 RNSSTROME 
HIDTH OF SCflH. 4ee flHBSTHOHS 
PHSSTROHS PER OVJ.: a 3! 



aio 



iio 



X Inm) 



Figure 2: The ultraviolet absorption spectrum of benzene vapor at room temperature. 
The spectrum was obtained using a GCA McPherson single-beam spec- 
trophotometer Interfaced to a PET/CBM microcomputer and Trendcom 100 dot- 
matrix printer. 



beam spectrophotometer into what is 
effectively a dual-beam device. The 
basic requirement is that the analysis 
be run twice, first in the reference 
mode, and then in the sample mode. 
An example of this type of application 
is shown in figure 2. This absorption 
spectrum of benzene was taken at room 
temperature with a single beam GCA 
McPherson spectrophotometer. The 
units of the wavelength scale are 4.56 
Angstroms/division; the ordinate is in 
absorbence units. The high spectral 
resolution is evident and comparable to 
that obtained from much higher -priced 
instruments. Individual portions of an 
absorption spectrum can be selected 
and magnified by changing the scan 
rate and the wavelength range and re- 
peating the scan. Dual-beam spectro- 
photometers are generally more de- 
sirable than single beam devices, but 
they are also much more expensive. 
Thus, the interfacing of a microcom- 
puter to the spectrophotometer re- 
sulted in enhanced capability without 
significant additional expense. 

References 

1. Saltsburg, H., Heist, R.H., and 
Olsen, T., Miciocomputeis in a Col- 
lege Teaching Laboiatozy — Pan 1, 



MICRO, No.53, October, 1982, 
pg. 53. 

2. Heist, R.H., Olsen, T., and 
Saltsburg, H., Miciocomputeis in a 
College Teaching Laboiatozy — Pan 
2, MICRO, No. 55, December, 1982, 
pg. 59. 

3. Olsen, T., Saltsburg, H., and Heist, 
R.H., Miciocomputeis in a College 
Teaching Laboiatozy — Pan 3, 
MICRO, No. 56, January, 1983, 

pg- 

4. West, R.C., Piogiamming the PET/ 
CBM, The Refeience Encyclopedia 
foi Commodoie PET/CBM Useis, 
Compute! Books, Greensboro, N.C., 
1982. 

5. Hampshire, N., The PET Revealed, 
Computabits Ltd., Somerset, 
England, 1980. 

6. See, for example, Dejong, M.L., Pio- 
giamming and Intezfacing the 6502, 
with Expeiiments, Howard W. Sams 
&. Co., Inc., Indianapolis, 1980; 
Zaks, R., 6502 Applications Book, 
Sybex, Berkeley, 1979. 



You may contact the authors at the 
Department of Chemical Engineering, 
University of Rochester, Rochester, NY 

14627. 




Attaciie-style cases for carrying and pro- 
tecting your complete computer set-up. 
Accommodates equipment in a fully oper- 
ational configuration. Never a need to 
remove equipment from case. Simply 
remove lid, connect power, and operate. 



AP101 
AP102 


Apple II with Single Drive 
Apple II with Two Disk 
Drives 


$109 




119 


AP103 


Apple II, 9 Inch Monitor & 
TWo Drives 






129 


AP104 


Apple III, TWO Drives & 
Sllentype Printer 






139 


AP105 


13" Monitor with 






Accessories 


99 


AP106 


AMDEK Color Monitor 


119 


RS201 


TRS-80 Model 1, Expansion 






Unit & Drives 


109 


RS2(J4 
AT301 


TRS-80 Model III 
ATARI Computers with 


129 




Peripherals 


109 


P402 


Centronics 730/737 & 






Radio Shack Printer 


89 


P403 


Epson MX70/80 or 






Mlcroline82A 


89 


P404 


Epson MX1 00 Printer 


99 


P405 


IDS 560 or Prism 






132 Printer 


109 


P406 


Starwriter/Printmaster 






F-10 Printer 


119 


P407 


OkldataMlcrollne 






83A or 84 Printer 


99 


P408 


Prowrlter 2 Printer 


99 


P409 


Prowriter (Apple Dot Matrix) 




Printer 


89 


IB501 


IBM Personal Computer 


129 


IB502 


IBM Monitor 


99 


HP601 


HP41 with Accessories 


99 


CM703 Commodore Model 64 






with Drives 


119 


CM704 Cnmmodore Model 64 






wIthDataset 


109 


NS010 


North Star Advantage 


139 


CC80 


Matching Attache Case (5") 


85 


CC90 


Matching Attache Case (3"] 


75 


cegr 


Matching Accessory Case 


95 


CC92 


5.25" Diskette Case 


49 



compuTorcasQcomoanv 

5650 Indian Mound Court 

Columbus, Oiiio 43213 

(614) 868-9464 

CALL TOLL FREE 
800-848-7548 



iMCRO 



No. 57 - February 1983 



MICRO 



91 



JMCdO 

CoCo Bits 



By John Steiner 

This month's column looks at tech- 
niques that allow you to interface your 
machine-language routines with BASIC . 
The Color Computer memory map, 
published by Tandy, leaves many un- 
documented locations. Hopefully I can 
put a few items in their correct places. 

To demonstrate the use of a RAM 
hook, I have included a list-pager pro- 
gram. [More on this later.) If you know 
any locations of RAM hooks, or ad- 
dresses of particular BASIC functions 
in ROM, please contact me. 

Ben Farmer of Charlottesville, VA, 
sent the following information on a 
print-routine hook: locations 159, 160, 
and 161 are called during print to 
screen or printer; and locations 410 to 
412 seem to hook to the keyboard after 
each BASIC keyword. Mr. Farmer also 
points out that there is a compatibility 
problem with EDTASM + and the 8-bit 
printer driver distributed by Radio 
Shack to people with 1.0 ROM. The 
driver is required to work with the 
DMP-100 printer, yet it won't work 
with the assembler. If anyone has found 
a solution to the problem, let me know. 

While I am on the subject of RAM 
hooks, I have a routine that interfaces 
with the LIST and LLIST command to 
page a list on the screen (see listing .1). 
Before loading the program, enter 
CLEAR 200, &H7FE5. This protects 
the routine from BASIC. Load the pro- 
gram by reassembling or POKEing the 
data into memory. To activate the 
routine, the hook at locations 383, 384, 
and 385 is used. These locations con- 
tain an RTS, and 383 is accessed after a 
LIST or LLIST. If an instruction is 
found, it can be executed. In this case, a 
JMP to the routine will be executed. As 
assembled, the page lister is written to 
fit at the top of a 32K machine. With 
one exception, the program is written 
in position-independent code. If you 
move the program, the location 
LINCNT must be defined to a valid 
RAM location. 

The program lists 14 lines to the 
screen and stops, waiting for a key- 
press, after which the next 14 lines are 



BATTERY _L 
OR ^ 
POWER 4- 
SUPPLY - 



GROUND 
THIS POINT 

i REMOTE 
, . ^ JACK 

X j_ I r-T-^ 



"mi 




25A684 



listed. To hook the program to BASIC, 
after loading the routine, enter: 

POKE 383, &H7E : POKE 384, &H7F : 
POKE 385, &HE7 



If you do not have extended BASIC, you 
will have to convert the hex numbers to 
decimal. Load a BASIC program and do a 
LIST. (If you do an LLIST, you will find 
that the program does not stop after 14 
lines, but continues until completed.) 
The routine is called just before 
each line in a listing. The opcode $7E 
causes a JMP to the start of the program 
at $7FE7. The routine checks location 
$006F (DEVNUM), which determines 
printer or screen status. If $6F contains 
$FE, the list is going to the printer; a 
$00 indicates the screen is the destina- 
tion of the print. When anything but 
zero is found, control returns to BASIC. 
If screen printing is being done, $7FE6 
is incremented by 1 . A CMP tests to see 
whether or not the fourteenth line has 
been printed. If not, control returns to 
BASIC. You can change the number of 



MECHANICAL 
SWITCH IN 
^ RECORDER 



CUT FOIL AT Xs 



TO 
RECORDER 



lines printed by changing the data 
in $7FF2. 

When 14 lines have been printed, 
control jumps to the GETKEY routine 
in BASIC. The program loops while 
waiting for a keypress, after which the 
count is reset to zero and control 
returns to BASIC. 

Other applications for this particu- 
lar RAM hook come to mind. For exam- 
ple, it would be easy to supply a line 
feed after the BASIC -generated caniage 
return for those printers that need it. 

Bob Gilbertson of Fargo, ND, pro- 
vided me with the circuit in figure 1. 
This circuit is a modification that 
allows the connection of high-current- 
drain cassette recorders to the light- 
duty relay inside CoCo. If you use a 
standard Radio Shack series recorder, 
you don't need this modification; but if 
you can't bear to spend money on a 
new recorder while an older machine 
just sits on the shelf, you can use this 
circuit. The RS recorder has a very light 
current drain, and the relay provided is 
more than adequate. If you use a re- 
corder with too much current drain. 







00100 «PAGER PROGRAM 








00110 «JOHN STEINER 








00120 «NOV. 8 


1982 








00130 ORG J7FE6 








00140 LINCNT EQU J7FE6 








00150 DEVHraw EQU ?6F 




7FE6 


00 


00160 


FOB MO 




7FE7 OD 


6F 


00170 START 


TST DEVNUM 


CK FOR LLIST 


7FE9 26 


lA 


00180 


BNE OUT 


IF SO THEN GO 


7FEB 7C 


7FE6 


00190 LINING 


INC LINCNT 


ADD 1 TO LINE 


7fEE B6 


7FE6 


00200 


LDA LINCNT 




7FF1 81 


CE 


00210 


CMPA ||I$0E 


SCREEN FULL? 


7FF:) 26 


OA 


00220 


BNE OUT 


IF NOT THEN GO 


7FF5 AD 


AOOO 


00230 LOOP 


JSR [JAOOO] 


GO GET KEYPRESS 


7FF9 AD 




00240 


TSTA 


CHECK FOR KEY 


7FFA 27 


F9 


00250 


BEQ LOOP 


IF NO KEY THEN tfAIT 


7FFC 7F 


7FE6 


00260 RESET 


CLR LINCNT 


SET LINE COUNT TO ZERO 


7FFF 39 




00270 OUT 


RTS 





92 



MICRO 



No. 57 - February 1983 



CoCO Bits (continued) 

the relay might stick closed and the 
recorder will not stop at the end of 
SAVES and LOADs. 

Bob's circuit places a PNP transistor 
in series with the power supply. The 
computer relay switches the transistor, 
which in turn switches the recorder. 
The circuit is representative of most 
portable cassette recorders. All wiring 
indicated exists within the cassette 
recorder itself; only the transistor and 
IK resistor are added to the circuit. The 
Xs indicate where a wire or foil should 
be cut. The jack assembly indicated is 
the motor remote control jack. Cut the 
lines as shown and iijstall the transistor 
and resistor. (If your cassette recorder is 
positive ground instead of negative 
ground, as in the schematic, use a 
suitable NPN transistor.) 

The circuit works by current flow- 
ing through the base lead, base bias 
resistor, and remote relay switch inside 
the computer. Although a transistor 
number is specified, almost any 
general-purpose PNP transistor will 
work. Choose one with a collector cur- 
rent at least twice the normal current 
draw of your particular cassette re- 
corder. The switching current is quite 
small and will keep the relay from 
sticking closed. 

When you finish the modification, 
you can test its performance with the 
following information. BASIC has two 
routines in ROM that control the con- 
dition of the cassette motor: MOTOR- 
OFF is located at $A7E9, and MOTOR- 
ON is located at $A7CA. EXEC 
SlHA/CA turns on the motor, and 
EXEC &HA7E9 turns it off. Another 
way to control the relay is with a POKE 
to the PIA at 65313. POKE 65313, 60 
turns on the motor, and POKE 65313, 
52 turns if off. Of course, you could just 
type MOTORON or MOTOROFF, but 
that wouldn't be nearly as much fun. 

Next month, I will take a look at 
some more RAM hooks and present 
more CoCo news. If you have anything 
to contribute, contact me at the address 
below, or through MICRO. 



You may contact the author at 508 Fourth 
Avenue ^fW, Riverside, ND 58078. 

iMCftO 



MICRObitS (Continued from page 88) 



Target-an AIM 65 Newsletter 

Need information for your AIM 65 
computer? News, software, and 
hardware are examples of items 
covered in the newsletter. Yearly 
subscription rates are $7.00 in the US 
and Canada, $12.00 elsewhere. Back 
issues are available beginning with 
1979 at the same per year rate. 

Target 

c/o Donald Clem 

RR#2 

Spencerville, OH 45887 



The State of the Art In 
Astro-Software 

Wide range of astrological and 
astronomical software of the highest 
quality. From powerful (and income- 
producing) astrological charting 
service packages and printing 
interpretation packages, to super- 
accurate computer ephemerises. For 
all Commodore computers, Apple 11 
Plus, and TRS-80. 

Matrix Software 

315 Marion Avenue 

Big Rapids, MI 49307 



OSI Super Defender 

Play this great arcade game at home. 
All machine code includes: scanner, 
smart bombs, laser fire, moving 
mountains, and more. Save your 
humanoids from the alien landers. 
Very smooth (half-character moves) 
graphics. $14.95 for CI, 2, 4 tape or 
5M"disk. 

DMP Systems 

319 Hampton Blvd. 

Rochester, NY 14612 



Commodore-64 Software! 

Enjoy these excellent professionally 
written programs: Septa-Cube Logic 
Puzzle — 3-dLmensional; combine 7 
pieces into a solid 3x3x3 cube. 
Advanced Sound Synthesizei — with 
graphics. Each program $17.95 
cassette, $21.95 disk. Add $2.00 
postage/handling charge. Send for free 
catalog. 

Dynamic MicroGraphic Software 
4289 Union Rd. 
Buffalo, NY 14225 



JMcno 



VIC-20 



i 

I 

I 

I 
I 

I 

i 



VIC-20 INTERFACING BLUE BOOK 

Did you know that your VIC can be used to 
control a 99« toy motor so effectively that it 
runs like a precision machine? Or that you can 
build an accurate digital thermometer using 
the VIC and four parts costing less than $5? 

These and other 18 interfacing projects 
selected for usefulness, ease of construction 
and low cost are detailed in the VIC-20 Inter- 
facing Blue Book, a veritable gold mine of prac- 
tical information on how to build a variety of in- 
terfaces for your computer. 

Projects include; Connecting VIC to your 
stereo; Pickproof digital lock; Capacitance 
meter; Liquid level sensor; Telephone dialer; 
Voice output; SK/ISK RAM/ROM expansion; 
128K RAM expansion; 8-bit precision D/A; 8-bit 
A/D converter; MX-80 interface and more. 

V^ritten by a college professor in a friendly 
and informative style, the Blue Book gives you 
theory of operation, schematics, program 
listings, parts list, construction hints and 
sources of materials for each one of the 20 pro- 
jects. 

If you want to get the most out of your VIC 
this book is a must. Cost is $14.95 (less than 
75« per proiect!). Price includes postage. 



micrDEJgnal oeptN 

P.O. BOX 22 
MLLWOOO NY 10546 



Please send me a copy of the Bkie Book. 
Enclosed my check (or S 



Above prices include postage in the 
U.S. CA res. add 6% tax. Foreign add $2. 



"■"'taiijpu SEf\J5Ei:.' 

"CARD/?" 
(CARD/PRINT) 

UNIVERSAL CENTRONICS 
PARALLEL PRINTER 
INTERFACE FOR THE VIC-20® 
Now you can use your VIC-20® with 
an EPSON MX-80 printer, or an OKI- 
DATA printer, or a TANDY printer, or 
just about anybody's printer. And you 
I don't tiave to give up ttie use of your 
user port (MODEM), or ctiange to \ 
special printer commands, or load any i 
special software driver programs to do ' 
it. 

• Outputs standard ASCII codes to | 
ttie printer. 

• Plugs in ttie VIC-20® printer serial 
i/o port. 

• Understands all standard VIC-20® i 
print commands. 

• No modification to your VIC-20®. 

• No special programs required. 

• Includes all necessary cables to 
tiook up a standard printer using 
Centronics parallel input. 

• MADE IN THE U.S.A. 
The "CARD/?" is a product of CARDCO. Inc 

$79.95 

TO ORDER. 
P O BOX 18765 
WICHITA, KS 67218 
(316) 634-4660 



^g 



Personal checl^s accepted 
(Allow 3 weei<;s) or 
CO D. (Add $2 00) 
Handling charges $2.00 
VIC-20" IS a registered trademarl< of Commodore 



No. 57 - February 1983 



MICRO 



93 



S llilLNTIINeir€N C€/HIPILirilNe S 




IB 



Q 

a 

B 

i 

B 
B 
B 

B 
B 

li 

B 
B 
B 
B 



Softlights 

By Fred Huntington 

Time to tell you about a nitty little program 
that s been around a while that deserves some 
mention. The Menu Generator is an excellent 
program that everyone should use on every 
disk to create a HELLO program to take the 
typing out of running programs. 

It creates menus quickly and painlessly. The 
publisher has even given permission to pro- 
grammers to use the generated menus in com- 
mercial programs — no royalties. Comes com- 
plete witn a free backup disk. 

The usual price is $39.95. Our price $33.89. 
But until April 30, you can have it for $17.99 
(#9380). 

MONEY TO BURN 

If you've got money to burn and want the best 
monitor for Apple around and do a lot of word 
processing, you have no choice but The 
Genius. At only $1695 (we'll ship free in U.S.) 
it includes an 80-column board, a special pro- 
gram to make it compatible with Word Star, and 
your choice of B/W, amber or green screen 
(only one). 

What makes this monitor so special is that it 
displays a full 57 rows. This means you can see 
a full page displayed, just like if will be printed. 
This is unheard of for the Apple. (#113). 
ULTIMA II SPECIAL 

The hottest new game out is On-Line's Ul- 
tima II at $59.95. Here's a special you won't 
beat. Buy any item from us (no matter how 
small) and you can have the Ultima II for only 
$37.99. This special ends April 30, 1983. 

Included in Ultima II is the fanciest packaging 
ever done by On-Line, a beautiful four-color 
17x22 cloth map, suitable for framing, two 
disks (three sides) and hours of fun. (#1 114) 
NEW COMPUTER 

We're in the process of installing a new Sage 
computer to run our business. This 16-bit, 
68000 computer combined with Flexware soft- 
ware (also available for the Apple) will allow us 
to have the fastest system ever installed by any 
mail order business. 

In less than the time it takes to type your 
name, we'll be able to tell you the status of your 
order, call up any invoice in the last year, tell 
you shipping cost for any hardware Hem, when 
back-ordered items will come in and much 
more. 

We're quite excited about it and will be sell- 
ing Sage and Flexware and doing custom pro- 
gramming for it. More on this later. 
RANA DRIVES 

We are now quite competitive on our Rana 
Drive prices. Give us a call for our new lower 
prices. 

We also have the new Gibson high speed 
light pen at a discount. This is a knockout item. 



At press time our price was $296. Call for latest 
pricing. (#114) 

Ice Demons is a nice new arcade game from 
the talented Matthew Jew. Listing at $29.95, 
our special this month is $32.95. (#7720). 

Omega Microwave has an excellent new 
game out called A City Dies Whenever Night 
Falls. List price is $29.95 and our special is 
$23.95. The documentation that comes with 
this is unbelievable. And it is copyable and 
listable. (#707) 

128K — $399 

Also from Omega, we're happy to be carry- 
ing their Ramex-1 28 128K board for only $399 
(a bargain even at the full list price of $499), It 
requires no removing of chips to install. It 
comes with powerful disk emulation software, 
which adds eight new DOS commands. It is the 
only 1 28K board that allows the user to load or 
save a full 136K VisiCalc file in 20 seconds. 
(#708) 

NEW 

#7071 Pleasure (adults only) Village $35.39 

#7070 Hands On! (adults only) Village $35.39 

#9Mi Prism (storybook and games) $16.89 

#9«8i Sheila - H.A.L Labs $31.19 

Bediform Redibinder - Great! OUi 

Flexware - The best, most flexible, and most expensive account- 
ing software ever made for Hie Apple OUI 

#8261 Lovers or Strangers $35.39 

Corona IBM PC look alike. Dynamite! CALL 

#117 The Toaster (two removable 5 meg 

cartridges) by Xcomp $3499.00 

#1 18 IDS paper feeder $439.00 

#119 CP/M Card (TM) - CP/M 3.0 (TM) + 6411 

memory + 6MHz speed Call for price 

AgDisk Agricultural software CALL 

#122 Compu-Music - toland $439.00 





B 
i 



Iranstar 130 daisy wheel printer with 
boldface and underscore. Six mo. 

ltd. warranty $749.00 

#682 Taxan COB color with board & cable . . . $399.00 
All Santa Clara and Davong drives available 

at discount 
#7380 Money Decisions (Eagle) special $149.00 

The Transtar 315 is a mind-blowing printer. It 
will dump any HIRES color screen in four- 
colors to the printer and to the paper. If you're 
playing a game, press the button and in a few 
seconds you'll have a four color printout of the 
screen. Traction or friction. Unbelievable. 
Should be ready for shipment shortly. Our price 
$699.00 complete! (#231) 

#33 PSIO Dual Function-Card - Videx $189.00 

#240 SRW Color Coder-5 different color library 

cases for carrying floppies $15.99 

We now have the complete line of Okidata 
printers. CALL 

Child's Play is an incredible new piece of soft- 
ware written by Mike Taylor for children three to 
seven years old. It includes an etch-a-sketch, a 
series of mazes in which the cutest ant you 
ever saw is guided to his musical reward, and a 
series of quizzes which teach a child concepts 
of bigger than, different from, etc. Published by 
Huntington (with our daughter in mind) we have 
priced this so everyone can afford to enjoy it. 
The disk is crammed-packed and is only 
$19.99. Order #8999. 

SSM has the hottest new modems in the busi- 
ness. Compatible with )ust atxjut everything. 
The following specials are good through April. 

#8562 Modemcard (300 baud) $339.00 

#8563 Modem 1200 (1200 BAUD) $549.00 

The following Transpaks include the 
ModemCard and the Source: 

#8564 Transpak-1 (includes Transend I) $309.00 

#8565 Transpak-2 (includes Transend 2) $349.00 

#8566 Transpak-3 (includes Transend 3) $539.00 

The following include 1200 baud modem 

and the Source 

#8567 Transpak-2 + (includes Transend 2) . . . . $799.00 

#8568 Transpak-3 -h (includes Transend 3) . . . . $899.00 

The following include the Source: 

#8560 Transend 1 $75.00 

#8561 Transend 2 $1 19.00 

#8569 Transend 3 CALL 

WE HAVE HUNDREDS OF ATAKI 

PfiOGRAMS IN STOCK. 

GIVE US A CALL. 

The absolutely most incredible program we 
carry is The Word Processor - ttie complete 
Bible on eight double sided disks plus one 
program disk. It will scan, search, and do unbe- 
lievable things. You II never find a better bar- 
gain. Sale price $149.99. (#7320) 



i 



I 

! 
I 
I 
I 
I 
1 
! 
i 



Call Toll-Free 800-344-5106 (outside California) 



I 

B 



HUMTINOTOM COMMITHM 



Post Ottice Box 1297 
Corcoran, California 93212 

Foreign Orders 209-992-4481 
In California 800-692-4146 



We take MastwrCard, American Exprtaa or VISA (inclucJe card # and 
Apple ■ is a registered trademarti of Apple Campuier. \nc. expiration date). California residents add 6% tax. Include $2.00 for postage. 
Pet • is a registered irademar* of Commodore. Foreign and ttardware extra. Foreign (excluding Canada) : remit US. cur- 

Aun-^'«'^i^iS!SS'Sl22!i;^«JlS!' '^"^ '*™=y' Checks on U.S. banks, use listed ctiarge cards, or make direct wire 

Alan ,sar,9,sieredtrademart.o(Attn,irx:. transfers through Security Pacifk; Bank, Cor^ran, for a $6.00 charge. All 

Outaide CalH. 600-344*5106 overseas orders shipped by air Send for tree catalog. Prices subject to 

change without notice. 



94 



MICRO 



No. 57 - February 1983 



iSMCftO 

Apple Slices 



By Tim Osborn 



This month's program, BUILDIT, 
demonstrates how programs external to 
VisiCalc can create and access VisiCalc 
worksheet files. Both VisiCalc novices 
and pros will learn from the following 
discussion. 

VisiCalc uses three file formats for 
data storage: DIF (Data Interchange 
Format|, standard worksheet files, and 
print format files. DIF is an excellent, 
well-documented communication aid 
that many packages use to send and 
receive information to and from 
VisiCalc. But, because DIF is designed 
for flexibility, it can be used indepen- 
dently of VisiCalc. To make DIF 
general and flexible, it was necessary to 
remove the formulas from the work- 
sheet, storing only the results of these 
formulas instead. The print files just 
store an image of the worksheet and, 
like DIF, do not include formulas. To 
save formulas it is necessary to use the 
"/SS" command, which creates a stan- 
dard worksheet file. 

After some investigation I found 
that these worksheet files are no more 
than a VisiCalc EXEC file that contains 
the data in the worksheet just as you 
would type it in. For example, the 
following worksheet 



A 

1 ALPHA 

2 BETA 

3 GAMMA 



B 

10 
5 
5 



(where B3 = Bl - B2 (GAMMA = 
ALPHA - BETA) ) would be stored as 
shown in figure 1 . 

With this method you could enter 
this worksheet into VisiCalc from the 
keyboard. The only unexpected thing is 
the last entry. The /X appears to be an 
undocumented VisiCalc command. 
The "/X-" tells VisiCalc to set the 
cursor direction to horizontal. The 
"/X>A1:" tells it to make Al the 
upper left-hand corner of the screen. 
The " > Al:" sets the cursor at Al. 



With this information I was able to 
write BUILDIT — a VisiCalc template 
building aid. BUILDIT builds account- 
ing worksheets that itemize entries 
vertically; the categories they belong to 
are produced horizontally. BUILDIT 
prompts the user for the categories and 
iems. The relationship between the 
various items is described to BUILDIT 
by placing a relationship operator in 
front of each item as it is entered. 
BUILDIT accepts four types of 
operators: 

1. A summable group member (a 
member in a list of items that pro- 
duces a sum) signified by a " + " in 
the first character position. There 
must be at least two members of any 
summable group, each member must 
be preceded by a " + ", and the Mst 
must be terminated with an " = " 
item entry (see below). 

2. A stand-alone sum (an item to be 
entered as a lump sum rather than 
itemized) signified by a "/" in the 
first position of the item entry. 

3. A sum, signified by an " = " in the 
first character position of the item. 
When BUILDIT encounters a sum 
following a summable group, it sets 
the template up to place the total of 
the preceding group in the row of 
this sum for all categories. If the sum 
is not immediately preceded by a 
summable group it sets the template 
up to sum the last two items entered 
that began with a "/", " = ", or a 
"-" and stores the result in this 
row for all categories. If two items to 



sum were not previously entered, an 
error message will be produced and 
the entry will not be accepted. 
4. A difference, signified by a " - " in 
the first position of the entry. A dif- 
ference takes the last two items that 
began with a "/", " -", or an " =" 
and sets the template up to subtract 
the last item (highest numbered, 
lowest down in the worksheet) from 
the second to the last, storing the 
result in this row. 

An Example 

Let's say you want to set up a work- 
sheet to handle sales (disks -i- books) 
less expenses (fixed + variable), com- 
pute the gross income, subtract taxes, 
and compute the net income. You also 
want to break down the worksheet by 
the first three months of the year 
(January through March) with a grand 
total column for the three months. 

BUILDIT prompts you first to enter 
the categories in the category 
maintenance mode. You just enter each 
category (JAN., FEB., and MAR.,) one 
at a time. There is no need to enter a 
grand total category because BUILDIT 
always generates it for you. When you 
are done entering categories just enter 
"Q" for quit (you are prompted for this 
in case you forget], and BUILDIT will 
give you a chance to make any editorial 
changes in the category edit mode. 

When you are done editing the 
categories just enter "Q" and BUILDIT 
will enter the item maintenance mode. 
BUILDIT then prompts you to enter 



Figure 1 




>B3:-l-Bl-B2 


Goto B3 and put the formula Bl - B2 there. 


>A3:" GAMMA 


Goto A3 and put the label "GAMMA" there. 


>B2:5 


Goto B2 and put the value 5 there. 


>A2:"BETA 


Goto A2 and put the label "BETA" there. 


>B1:10 


Goto Al and put the value 10 there. 


>A1: "ALPHA 


Got Al and put the label "ALPHA" there. 


/Wl 


Set global parameter - one window. 


/GOC 


Set global order of recalculations to columns. 


/GRA 


Set recalculations on automatic. 


/GC9 


Set column width to 9 characters. 


/X-/X Al: Al: 


See below. See text. 



No. 57 - February 1983 



MICRO 



95 



Apple Slices (continued) 

item number 1. Item 1 would be 
DISKS, which is one source of SALES (a 
member of the summable group 
SALES]. Inform BUILDIT of this by 
entering "+ DISKS". Next you enter 
"+ BOOKS" to tell the program that 
"BOOKS" is the second member of 
this group. Entering "= SALES" tells 
the program to set the worksheet to 
total the "DISK" and "BOOKS" en- 
tries and place the result in "SALES". 
The next three entries follow the same 
logic: 1, "+FIX. EX.", 2. "-i-VAR. 
EXP.", and 3. "=TTL EXP." (FLXED 
EXPENSE + VAEJABLE EXPENSE = 
TOTAL EXPENSE). 

The gross is the difference between 
SALES less TOTAL EXPENSES, so the 
next entry would be " -GROSS". The 
next item, taxes, is not itemized or 
computed so it is considered a stand- 
alone sum. Taxes would be entered as 
"/TAXES". The only thing left to do is 
compute the net income, which is 
GROSS - TAXES. The net income 
item would thus be entered as 
"-NET". 

Now enter "Q" to end item 
maintenance and enter item edit mode 



Figure 2 














A B 




C 




D 




E 


1 JAN. 




FEB. 




MAR. 




GRAND TTL. 


2 DISKS 












@SUM(B2...D2) 


3 BOOKS 












@SUM(B3...D3) 


4 SALES @SUM|B2. 


.B3| 


@SUM|C2. 


.C3| 


@SUM(D2. 


.D3) 


@SUM[B4...D4) 


5 FIX. EXP. 












@SUM(B5...D5J 


6 VAR. EXP. 












@SUMlB6...D6i 


7 riL.EXP. @SUM(B,5. 


.B6) 


@SUM(C5. 


.C6) 


@SUM(D5. 


.D6| 


@SUM(B7...D71 


8 GROSS +B4-B7 




+ C4-C7 




+ D4-D7 




@SUM|B8...D8) 


9 TAXES 












@SUM(B9...D9) 


10 NET +B8-B9 




+ C8-C9 




+ D8-D9 




@SUM(B10...D10) 



where you can make any editorial 
changes. When you are done editing, 
enter "Q". You will then be prompted 
to enter a file name to save the work- 
sheet/template. After the program has 
finished writing out your file, run 
VisiCalc and use the "/SL" command 
to load the worksheet/template. See 
the template in figure 2 (I have replaced 
the zeros with the formulas for the 
given worksheet coordinate). Notice 
that the operators are stripped off from 
the items and the grand total column is 
automatically generated. 

BUILDIT is fully interactive and all 
relationships are validated up front. If 



they are not correct, you are told which 
operators would be valid. You are 
always prompted and never left won- 
dering how to respond. It is simple to 
use (only four operators] but is de- 
signed for a limited number of applica- 
tions. It is designed for accounting ap- 
plications where only sums and dif- 
ferences are used. With modifications 
it could be made to handle all but the 
most complicated worksheet/tem- 
plates. Perhaps as important as its 
application, is the fact that it 
demonstrates how programs external to 
VisiCalc can be used to create VisiCalc 
templates. 



Listing 1 



10 GOSUB 1000: REM INITIALIZE 

15 AflY$ = "CATEGORY" .■PROCESSJ = "MAINTENANCE" 

20 GOSUB 2000: REM GET + EDIT CATEGORIES 

21 FOR J = 2) TO NUM:CT$(J) = IN?(J): NEXT 

22 NC = NUM: REM SAVE NUMBER OF CATEGORIES 
25 AflY$ = "ITEM": PROCESS? = "MAINTENANCE" 

30 GOSUB 2000: REM GET + EDIT ITEMS 

31 FOR J = TO mjM;IT$(J) = IN$(J): NEXT 

32 NI = NUM: REM SAVE NUMBER OF ITEMS 
50 GOSUB -tOOO: REM BUILD FILE 

60 PRINT CD? "CLOSE ";FILE$ 

70 END 

1000 CDS = CHR$ (4): HOME 

1010 DIM INJ(60): DIM CT$(60).- DIM IT$(6el) 

1020 FOR K = TO 8: READ MSG$(K) : NEXT 

1500 RETURN 

2000 J = 2l:N0DE ^ i 

2005 GOSUB 2010: GOTO 2015 

2010 LN = (40 - ( LEN (AfiYS) 

2011 HOME : FOR X = 1 TO LN 
INVERSE : PRINT ARY$;" 
IF J = 6«l THEN HTAB 9 



+ LEN (PROCESS?))) / 2 

PRINT " ";: NEXT : 
"; PROCESS?: NORMAL : RETURN 

VTAB 23: 
INVERSE : PRINT "MAXIMUM ";ARY?i" REACHED": 
FOR X = 1 TO 2000: NEXT X: NORMAL : GOTO 2028 
HTAB 2: VTAB 10: PRINT "ENTER ";: INVERSE : 
PRINT "Q";: NORMAL : PRINT" TO END "; 
ARY?;" MAINTENANCE" 

HTAB 2: VTAB 12: PRINT ARY$;" NUMBER ";J + 1;: 
INPUT " NAME ";IN?(J) 

IF IN?(J) = "" THEN GOSUB 2010: GOTO 2015: REM DONT ALLOW NULL 
IF IN?(J) = "Q" AND J = THEN INVERSE : 
HTAB 1: VTAB 22: PRINT "YOU MUST MAKE AT LEAST ONE ENTRY";: 
NORMAL : FOR K = TO 2000: NEXT K: GOSUB 2010: G0TO2015 
IF IN?(J) = "Q" THEN IN$(J) = "": GOTO 2028 
IF ARY? = "ITEM" THEN GOSUB 7000: 
REM CHECK FOR "+" "-" "/" OR "=" 
2027 J = J + 1: HTAB 12: VTAB L2: GOSUB 9000: GOTO 2005 
IF ARY? = "CATEGORY" THEN GOSUB 2010: GOTO 203^ 
IF NODE = 3 OR NODE = 6 THEN GOSUB 2010: GOTO 2034 



2015 



2016 



2017 



2020 
2021 



2022 
2025 



2028 
2029 



Listing 1 (Continued) 



2030 GOSUB 9100: GOTO 2017: REM DISPLAY ERROR MSG+CONT. 

2034 HTAB 5: VTAB 10: PRINT "EDIT ";ARY?;: 
INPUT " (Y)ES OR(N)0 ";A? 

2035 NUM = J: REM SAVE NO. OF ENTRIES 

2036 IF LEFT? (A?,l) = "Y" THEN GOSUB 2500: GOTO 2040 
2038 IF LEFT? (A?,l) <> "N" GOTO 2034 
2040 RETURN 
2500 NUM = J: REM SAVE NUMBER OF ENTRIES 

2502 PROCESS? = "EDITING" 

2503 GOSUB 2010: VTAB 2: HTAB 1:SP? = " " 
FOR I = TO NUM STEP 3 
IF I = 9 THEN SP? = " " 
IF IN?(I) = "" THEN GOTO 2535 
HTAB 1: PRINT I + 1;SP?; LEFT? (IN?(I),9); 
IF IN?(I + 1) = "" THEN GOTO 2535 
HTAB 14: PRINT I + 2;SP?; LEFT? (IN?(I + 1),9); 
IF IN?(I + 2) = "" THEN GOTO 2535 
HTAB 28: PRINT I + 3;SP?; LEFT? (IN?(I + 2), 9) 
NEXT I 

VTAB 23: HTAB 1: PRINT "CHANGE NO. 
INVERSE : PRINT "Q";: NORMAL : 
PRINT " TO END ";: INPUT "";A? 
IF A? = "Q" THEN RETURN 

2550 LN = LEN (A?):GD? = "Y":ZRO? = "Y" 
2560 FOR I = 1 TO LN:MD? = HID? (A?, I, 
2565 IF MD? > "0" AND MD? < ":" 

THEN ZRO? = "N": GOTO 2575 
2567 IF MD? = "El" GOTO 2575 
2570 GD? = "N":I = LN: REM REQUEST IS NOT NUMERIC 

2575 NEXT 

2576 IF GD? = "N" THEN MSG? = "NUMERIC": GOTO 2580 

2577 IF ZRO? = "Y" THEN MSG? = "NON ZERO": GOTO 2580 

2578 GOTO 2595 

2580 VTAB 23: GOSUB 9000: VTAB 23: HTAB 1: PRINT "INPUT "; 

MSG?;" ";ARY?;" ";: INPUT "";A?: GOTO 2545 
2595 NUM» = VAL (A?): REM CONVERT TO NUMERIC 
2600 IF NUM» > NUM THEN VTAB 23: GOSUB 9000: 

VTAB 23: INPUT "REENTER, TOO HIGH ";A?: GOTO 2545 
2602 IN? = IN?(NUM» - l) 

(Continued) 



2505 
2506 
2507 
2510 
2515 
2520 
2525 
2530 
2535 
2540 



2545 



.ENTER 



,1) 



96 



MICRO 



No. 57 - February 1983 



Listing 1 (Continued) 



2605 VTAB 23: GOSUB 9000: VTAB 23: HTAB 1: 

PRINT "CHAMGE ";AHY$;" TO ";: INPUT "";IN$(HU«* - l) 
2610 IF AHYJ = "CATEGORY" THEN GOTO 2503 
2612 GD$ = "Y":NODE = i 

2615 FOR J = el TO NUM - 1: GOSUB 7000: 
IF GD$ = "N" THEN GOTO 2620 

2616 NEXT 

2617 IF NUM* <> NUM GOTO 2620: REM SEE IF LAST ITEM CHAJJGED 

2618 IF (NODE = 3 OR NODE = 6) THEN GOTO 2620 

2619 GD$ = "N": GOSUB 9100: FOR K = TO 4000: NEXT K: 

REM DISPUY ERROR MSG + DELAY 

IF GD? = "N" THEN INj(NUMi - 1) = IN$ 

GOTO 2503 

DIM FRM$(NI,3): FIRST = - 1:LAST = -1 

FOR K = 8! TO NI - 1;LT$ = LEFT? (IT?(K),1) 



2620 
2700 
4000 
4010 
4015 
4020 
4060 
4070 
4072 



IF LT$ 

IF LT$ 

IF LT? 

IF LT? 

IF LT? = "/" 
4075 LAST = K 
4077 NEXT : REM 
4080 GOTO 4300 
4100 IF LAST > 
4105 FOR L = K ■ 
4110 IF LEFT? (IT?(L),1) 
4112 NEXT 

4115 FRM?(K,1) = "gSUM(" 
4120 FRM?(K,2) = STR? (L 
4130 FRM?(K,3) = STR? (K 
4l40 RETURN 
4150 FRM?(K,1) 



AND LAST = - 1 GOTO 4077 
THEN FIRST = LAST: LAST = 
THEN GOSUB 4100 
THEN GOSUB 4200 
THEN FIRST = LAST 



1: GOTO 4077 



K 

- 1 THEN GOTO 4l50 
1 TO STEP - 1 
< > 



3) 
1) 



+" THEN GOTO 4115 



":FR«$(K,2) = STR? (FIRST + 2) 

+ "+":FRM?(K,3) = STR?(LAST + 2) 
4170 FIRST = LAST: RETURN 
4200 FRM?(K,1) = "+":FRM?(K,2) = STR? (FIRST + 2) 

+ "-":FRM?(K,3) = STR?(LAST + 2) 
4210 FIRST = LAST: RETURN 

4300 HOME : VTAB 4: INPUT "ENTER FILE NAME ";FILE?: GOSUB 11000 

4301 IF FILE? = "" GOTO 4300 

4302 ONEHR GOTO 4305 

4303 PRINT CD?"DELETE ";FILE? 

4304 PRINT CD?"0PEN ";FILE?: GOTO 4306 

4305 PRINT CD?"OPEN "jFILE?: CALL 768: REM REPAIR ONERR DAMAGE 

4306 FOR K > NI - 1 TO 1^ STEP - 1 

4307 COL = NC + 2: GOSUB 4900:R0tf? = STR? (K + 2) : 

4308 A? = ">" + COL? + ROW? + ":«SUM(B" + ROW? + "..." 

4309 COL = NC + 1: GOSUB 4900:A? - A? + COL? + ROW? + ")" 

4310 GOSUB 5000: REM WHITE RECORD 
4315 FOR L = NC - 1 TO S( STEP - 1 

4320 COL = L + 2: GOSUB 4900: REM FIGURE LITERAL COLUMN NAME 

4325 IF FRM?(K,1) = "" THEN 4340 

4330 A? = ">" + COL? + ROW? + ":" + FRM?(K,1) 

+ COL? + FRM?(K,2) + COL? + FRM?(K,3) 
4335 GOSUB 5000: REM WRITE RECORD 
4340 NEXT : REM L 
4345 A? = ">A" + ROW? + ";" + CHR? (34) 

+ RIGHT? (IT?(K), LEN (IT?(K))- 1) 
4350 GOSUB 5000: REM WRITE 



4355 NEXT : REM K 




4360 COL = NC + 2: GOSUB 4900 




4365 A? = ">" + COL? + "1:" + 


CHR? (34) + "GRAND TTL" 


4370 GOSUB 5000 




4375 FOR K = NC - 1 TO el STEP 


- 1 


4380 COL = K + 2: GOSUB 4900 




4385 A? = ">" + COL? + "1:" + 


CHR? (34) + CT?(K) 


4390 GOSUB 5000: NEXT 




4400 RETURN 




4900 IF COL > 52 THEN COL? = 


"B" + CHR? (COL + 12): GOTO 4915 


4905 IF COL > 26 THEN COL? = 


"A" + CHR? (COL + 38) : GOTO 4915 


4910 COL? = CHR? (COL + 64) 




4915 RETURN 




5000 PRINT CD?"WHITE ";FILE? 




5005 PRINT A?: RETURN 




7000 LFT? = LEFT? (IN?(J),l) 




7010 IF NODE = el GOTO 7100 




7015 ON NODE GOTO 7200,7300,7400,7500,7600,7700,7800,7900 



7100 IF LET? = "+" THEN NODE = 1: RETURN 

7105 IF LFT? = "/" THEN NODE = 3: RETURN 

7110 GOTO 8000: REM SEND ERROR MESSAGE 

7200 IF LFT? = "+" THEN NODE = 2: RETURN 

7210 GOTO 8000 

7300 IF LFT? = "+" THEN RETURN 

7310 IF LFT? - ">" THEN NODE = 3: RETURN 



Listing 1 (Continued) 

73 111 GOTO 8000 

7400 IF LFT? = "+" THEN NODE = 4; RETURN 

7410 I? LFT? = "/" THEN NODE = 6: RETURN 

7420 GOTO 8000 

7500 IF LFT? - "+" THEN NODE = 5: RETURN 

7510 GOTO 8000 

7600 IF LFT? = "+" THEN RETURN 

7610 IF LFT? = "=" THEN NODE = 6: RETURN 

7615 GOTO 8000 

7700 IF LFT? = "+" THEN NODE = 7: RETURN 

7705 IF LFT? = "/" THEN RETURN 

7710 IF LFT? = "=" THEN RETURN 

7715 IF LFT? = "-" THEN RETURN 

7720 GOTO 8000 

7800 IF LFT? = "+" THEN NODE = 8: RETURN 

7805 GOTO 8000 

7900 IF LFT? = "+" THEN RETURN 

7905 IF LFT? = "=" THEN NODE = 6: RETURN 

8000 HTAB 1: VTAB 22: GOSUB 9000 

8005 HTAB 1: VTAB 22: INVERSE : PRINT "NUMBER "; 

J + 1;"'S 1ST CHAfi. MUST BE ";MSG?(NODE) : NORMAL 

8010 FOR K = 1 TO 3500: NEXT K 
8012 J = J - 1:GD? = "N" 

8015 RETURN 

9000 PRINT " "; 

9010 RETURN 

9100 HTAB 1: VTAB 22: INVERSE : PRINT 

"1ST CHAR OF LAST ITEM MUST BE =,/ OR -";: NORMAL 

9105 RETURN 
10000 DATA "+ OR /","+","+ OR =","+ OR /", 

"+","+ OR =","+, /, = OR ","+","+ OR =" 
11000 FOR X = 768 TO 777: READ XX: POKE X,XX: NEXT 
11002 RETURN 
11005 DATA 11^4,168,11^4,166,223,154,72,152,72,96 



iMCftO 



1^ 



ADVANCED 



m 



" ii .ii ;!r 



Zoom HiRes Graphic Printing 
for Apple Computers 

Print front or back view of either or both screens 
Print upright, upside down, rotated left or right 
Selectable printing densities for many printers 
Easily place zoom viewport using on-screen crosshairs 
Large range of scale factors, independently selected 
Load files to either screen in just 5 l<eystrol<es 
Type upper/lower case English or Greek text on screen 
Attach screen dump to your own programs, complete 
details 

Real Apple II DOS 3.3 format — Unprotected backup 
with COPYA 

Supports over 70 dot matrix and letter quality printers 
Supports serial, parallel, graphic, and buffer I/O cards 
Also works with the Basis and Franklin Computers 
Only $34.95 postpaid or see your dealer 
Versions without text annotation available for 
Apple II Pascal $34.95 

Apple III SOS 1.1 $44.95 



9i 



s 



2281 Cobble Stone Court 

Dayton. Ohio 45431 

513/426-3679 



HlBPt 




Dealer Inquiries 
Invited! 



M 



No. 57 - February 1983 



MICRO 



97 



Apple Slices icommr 

item number 1. Item 

DISKS, which is one •■ 

member of the 

SALES). Inforr- 

entering " + ' 

"+BOOK 

"BOO'' 

this 

tv 



»f 



accepts simple to complex sentences, but works best with 
shorter ones. 



lus, 48K 



QS 



BeimuiiL, v.,..! ^ 

Description: The product provides the capability to create 
and manipulate large lists of information. List manage- 
ment is performed by high-speed search and sort routines. 

Pluses: The system is expandable in that it will operate 
with from one to eight disk drives on line, providing 
management of up to 24000 records (4000 characters/ 
record) of data. Built-in features permit printing form 
letters, mailing labels, and envelopes. A special feature for 
list backup is provided. 

Minuses: You can use the program with only one disk 
drive, which makes it possible to destroy the program 
disk. The system should have been designed to prevent 
this rather than risk user forgetfulness. The company says 
only one list can be stored per disk because of the need to 
store large lists, but I think a multiple short list per disk 
option should have been built in. Neither of these prob- 
lems are serious; the product is quite usable. 

Documentation: Adequate. Numerous examples are pro- 
vided instead of explanation. 

Skill level required: The user needs exposure to the prob- 
lems of list management to get maximum utility from this 
product. 

Reviewer: Chris Williams 



Product Name: ESTHER 

Equip, req'd: 64K TRS-80 Color Computer 

One disk drive, FLEX DOS 
Price: $54.95, $74,95 with source 

Manufacturer: Frank Hogg Laboratory 

770 James St. 

Suite 215 

Syracuse, NY 13203 
Author: Dale Puckett 

Description: ESTHER shows how a computer is capable of 
artificial intelligence. ESTHER will remember your name 
and ask you questions in an effort to get you to unload 
some of your problems. If you want to show your friends 
what your computer can do, ESTHER will help break the 
ice. But tell ESTHER to "shut up!" and the program will 
end. It is written in assembly language and the responses 
are much faster than a similar program in BASIC. ESTHER 



Pluses: ESTHER comes in several formats — the 6800, 
6809, FLEX, or even Radio Shack version on disk. The pro- 
gram is fast and responds intelligently to simple sentences. 

Minuses: Proper nouns must be capitalized for ESTHER to 
recognize them. 

Documentation: A detailed manual includes clear instruc- 
tions for loading and running; some of the major subrou- 
tines of the program are covered in detail. A little back- 
ground on artificial intelligence programs is included. 

Skill level required: None. 

Reviewer: Bill Ball 



Product Name: WP 6502 Version 1.3a 

Equip, req'd: OSI Disk System 

Price: $250 (65D) 

$ 25 Upgrade from Version 1.3 

Also available in 65U 
Manufacturer: Dwo Quong Fok Lok Sow 

548 Broadway 

Suite 4F 

New York, NY 10012 
Description: WP 6502 is a full-feature word processor for 
OSI computers. Text files are created and edited with the 
TYPE, INSERT, DELETE, and REPLACE commands. 
Sentences and paragraphs can be rearranged via the block 
move utility. The global edit command allows all occur- 
rences of "SMITH" to be replaced with "BROWN". Fixed 
segments of texts can be called into the current file by typ- 
ing four control characters. All disk operations are per- 
formed by the file-clerk utility including LOAD, SAVE, 
RENAME, ERASE, and DIRECTORY. 

Pluses: Owners of earlier versions of WP 6502 can upgrade 
to revision 1.3a at a small additional cost. The file clerk 
utility includes a copy routine to initialize disks and make 
backup copies of any text files or even WP 6502. A 
memory test and disk test are included in the file clerk. 

There is an INSTALL command, which allows WP 6502 
to be custom configured to your needs. Options include 
changing default parameters and assignments of control 
characters, as well as accommodating differences in ter- 
minal and printer character sets. 

Minuses: Text files created by version 1.3 must be edited 
before running on version 1.3a to reflect the changes in the 
margin, tab, and line feed control characters. Editing is 



98 



MICRO 



No. 57 ■ February 1983 



Reviews in Brief (continued) 

done on the unformatted text file. In this mode, control 
characters are displayed but do not function and words 
may be split between lines. The user must flip back to the 
view mode to see the effect of his editing on the formatted 
output. 

Documentation: The program is supplied with an opera- 
tion manual and a training manual. The training manual is 
written for the non-computer user. The disk is supplied 
with a number of text files already in place complete with 
errors. 

Skill level required: No computer knowledge necessary. 

Reviewer: Earl D. Morris 



Product Name: Touch Typing Tutor 

Equip, req'd: VIC-20 (5K or more) 

Price: $15.95 

Manufacturer: Taylormade Software 

8053 E. Avon Lane 

Lincoln, NE 68505 
Author: Marian Taylor 

Description: The Touch Typing Tutoi package contains 
two programs to teach the beginner how to type by touch 
rather than by "hunt 'n peck." The first program, 
LESSONS, is divided into 19 separate drills on the finger- 
ing of keys, ranging in difficulty from the "home row" in 
the first drill to punctuation in the last drill. The VIC 
tracks your progress and shows your % correct for each 
drill. The second program, PRACTICE, gives you random- 
letter sequences and then measures your speed and ac- 
curacy as you type in the sequences. 

Pluses: Fun, useful, and well done! My kids (ages 9 and 10] 
love it; they learned where all the keys are effectively and 
enjoyably. 

Minuses: Typing random letter sequences is not really a 
good test of typing speed. Random sentences would be 
more realistic. 

Documentation: The 12-page manual is well written and 
quite comprehensive. 

Skill level required: None. 

Reviewer: David Malmberg 



VIC Adventure Cartridges 

VIC-20 (5K or more) 

$39.95 each 

Commodore Business Machines, Inc. 

487 Devon Park Drive 

Wayne, PA 19087 

Scott Adams 

Description: Commodore has released the first five of 
Scott Adams' classic Adventure games on cartridge for the 
VIC-20. These are outstanding games that allow you to in- 
dulge in fantasy role playing by giving your VIC simple 
one- or two-word commands, like GO NORTH, EXAMINE 



Product Name: 
Equip, req'd: 
Price: 
Manufacturer: 



Author: 



TM 



}IIM's eating 
your A[^le? 

Find out with Apple-Cillin II 

If you use your Apple for your business or 
profession, you probably rely on it to save you 
time and money You can't afford to guess 
wfietfier it is working properly or not. Now you 
don't fiave to guess. Now you can find out 
witti Apple-Cillin II. 

Apple-Cillin II is ttie comprefiensive diagnostic 
system developed by XPS to check the 
performance of your Apple II computer system. 
Apple-Cillin II contains 21 menu driven utilities 
including tests for RAM memory ROM 
memory, Language Cards, Memory Cards, 
DISK system. Drive Speed, Keyboard, Printer, 
CPU, Peripherals, Tape Ports, Monitors and 
more. These tests will thoroughly test the 
operation of your Apple, and either identify a 
specific problem area or give your system a 
clean bill of health. You can even log the test 
results to your printer for a permanent record. 

Apple-Cillin II works with any 48K Apple system 
equipped with one or more disk drives. 

To order Apple-Cillin II - and to receive 
information about our other products - Call 
XPS Toil-Free: 1-800-233-7512. In Pennsylania: 
1-717-243-5373. 

Apple-Cillin II: $49.95. PA residents add 6% 
State Sales Tax. 



XPS 



XPS, Inc. 

323 York Ro3d 

Cadisle. Pennsylvanis 1/013 

800-233-7512 

n/-243-53/3 



Apple It is a registered trademarf( of Apple Computer Inc. 



No. 57 - February 1983 



MICRO 



99 




Vi--^ 





Let Unique Data Systems help you raise your sights on AIM 65 
applications with our versatile family of AIM support products. 

•Go for high quality with our ACE-100 Enclosure. It accom- 
modates the AIM 65 perfectly, without modification, and features 
easy access two board add-on space, plus a 3" x 5" x 1 7" and a 
4" X 5" X 15.5" area for power supplies and other com- 
ponents. $186.00. 

• Get high capability with Unique Data System's add-on boards. 
The UuS-1 00 Series Memory-l/0 boards add up to 1 6K bytes of 
RAM memory or up to 48K bytes ROM/PROM/EPROM to your 
Rocl<well AIM 65. You also get 20 independently programmable 
parallel I/O lines with an additional user-dedicated 6522 VIA, two 
independent RS-232 channels with 16 switch-selectable baud 
rates (50 to 19.2K baud), and a large on-board prototyping area. 
Prices start at $259.00. 

• If you need to protect against RAM data loss, the UDS-100B of- 
fers an on-board battery and charger/switchover circuit. $296.00. 

• Heighten your AIM 65's communications range by adding the 
UDS-200 Modem board. It features full compatibility with Bell 
System 103 type modems and can be plugged directly into a 
home telephone jack via a permissive mode DAA. No need for a 
data jack or acoustic coupler. The UDS-200 also has software- 
selectable Autoanswer and Autodial capability with dial tone 
detector. The modem interfaces via the AIM 65 expansion bus, 
with the on-board UART and baud rate generator eliminating the 
need for an RS-232 channel. $278.00. 

• The UDS-300 Wire Wrap board accepts all .300/.600/.900 IC 
sockets from 8 to 64 pins. Its features include an intermeshed 
power distribution system and dual 44-pin card edge connectors 
for bus and I/O signal connections. $45.00. 

• Get high performance with the ACE-100-07 compact 4" x 5" x 
1 .7" switching power supply delivering -F 5V @ 6A, -H 2V @ 1 A, 
and -F24V for the AIM printer. $1 18.00. 

Installation kits and other related accessories are also avail- 
able to implement your AIM expansion plans. Custom hard- 
ware design, programming, and assembled systems are also 
available. High quality, high capability, high performance, with 
high reliability ... all from Unique Data Systems. Call or write 
for additional information. 

Unique Data Systems Inc. 
1600 Miraloma Avenue, Placentia, CA 92670 

(714)630-1430 



Reviews in Brief (continued) 

HOLE, JUMP, THROW AXE, etc. You can discover a 
pirate's treasures, find and disarm a bomb before it blows 
you up, or other daring exploits. These complicated and 
time-consuming games are loads of fun for adventurers of 
all ages. Games in progress may be saved on and loaded 
from tape. For added excitement, use the Votrax Type 'N 
Talk to run the first series of talking adventures. 

Pluses: Great adventures creatively done! The cartridge 
format is easy to use, and allows a 16K program to run 
without any additional memory beyond the standard 5K. 
The talking feature is fun if you are fortunate enough to 
have a Votrax. 

Minuses: These cartridges require you to LOOK (or "L" 
for short) at your surroundings whenever you move to a 
new location. This quickly becomes tedious. The docu- 
mentation on the Votrax interface is wrong; it requires a 
2400 baud rate rather than the 1200 rate claimed. 

Documentation: Each of the five cartridges comes with 
the same well- written 12-page manual that explains the 
basics of adventuring, plus gives valuable hints for suc- 
cessful play. 

Skill level requited: None, other than imagination, 
perseverance, and luck. 

Reviewer: David Malmberg 



Product Name: 
Equip, req'd: 



Price: 
Manufacturer: 



Author: 



Story Machine 

Apple n with Applesoft or Apple II 

Plus with 48K RAM, DOS 3.3 

$34.95 

Spinnaker Software 

215 First St. 

Cambridge, MA 02142 

(617) 868-4700 

Design Ware 
Copy Protection: Yes 

Description: Story Machine is an educational program to 
help children, ages 5 to 9, write sentences, paragraphs, and 
simple stories. It develops vocabulary skills and keyboard 
familiarity. You type in simple sentences and the program 
acts them out in graphics . 

Pluses: Story Machine is well written and interesting 
enough to keep a young child occupied for hours on end in 
writing short amusing stories. It is easy to use and has an in- 
formative guide. The graphics are illustrative and well done. 

Minuses: The dictionary is limited and exacting. Perfect 
typing, not all that easy for a five-year-old, is required; no 
unnecessary spaces are allowed. The child must also be 
reading fairly well to run the program on his own. 

Skill level required: Reading ability and interest in com- 
puters. Five years old might be too young. 

Reviewer: Phil Daley 

iMCftO 



100 



MICRO 



No. 57 - February 1983 



iJMCftO 

Software Catalog 



Name: The DOS 

Enhancet (TDE) 

System: Apple II, DOS 3.3, 

ROM/RAM card 
Memory: 48K 
Language: Machine Language 
Hardware: Disk II 
Description: The DOS En- 
hancer (TDE) utility creates 
copyable DOS 3.3 disks that 
start up directly and quick- 
load a RAM card in 1.8 sec- 
onds. Its remarkable speed and 
efficiency comes from fixing 
all known "bugs," rewriting 
DOS (including the file 
manager) for enhanced speed 
of operation and assembling 
the resultant new TDE Quick 
DOS. Compatibility with stan- 
dard Apple DOS 3.3 programs 
is maintained. 
Price: $69.95 
Includes utility disk, 
training/ support disk, and 
complete documentation. 
Author: Art Schumer 
Available: 
S&H Software 
58 Van Orden Road 
Harrington Park, NJ 07640 
(201) 768-3144 



Name: Advanced 

X-Tended Editot 

System: Apple II, Apple II 

Plus; DOS 3.3 
Memory: 48K 
Language: Applesoft 
Description: The Advanced 
X-Tended Editor (AXE) is a 
professional programming aid 
that provides the user with a 
text editor-style extension to 
the standard Applesoft oper- 
ating system. AXE is called 
upon by one of over thirty 
commands that are easy, log- 
ical, and operate in the normal 
Applesoft entry mode or in 
AXE's editing modes. AXE 
operates on BASIC code as 
stored in memory by Apple- 
soft. No conversion of code to 
text is required. In addition, all 
Apple n DOS and monitor com- 
mands are left fully functional. 
Price: $69.95 

Includes floppy diskette and 

complete documentation. 
Available: 

Versa Computing, Inc. 

3541 Old Conejo Rd. 

Suite 104 

Newbury Park, CA 91320 

(805) 498-1956 



Name: GiaFORTH 
System: Apple II or Apple 

nPlus 
Memory: 48K 
Language: Machine Language 
Hardware: DOS 3.3 and one 
or more disk 
drives 
Description: GiaFORTH is a 
fast compiled graphics lan- 
guage similar to FORTH, but 
with many built-in graphics 
features, including line and 
area graphics, Turtlegraphics, 
character graphics, and ani- 
mated 3-D graphics. 
Price: $75.00 

Includes diskette and 

220-page manual. 
Author: Paul Lutus 
Available: 

Insoft, Inc. 

10175 SW Barbui Blvd. 

Suite 202B 

Portland, OR 97219 

Name: Semi Draw 
System: TRS-80 Color 

Computer or TDP 
System 100 
Memory: 32K 
Language: Extended BASIC 
Description: With Semi Draw 
your computer's keyboard or 
joystick draws in eight colors 
with semi-alpha graphics 8, 12, 
and 24. Semi Draw provides 
animation and dumps the pic- 
ture of the screen to a Line 
Prmter Vn/Vni, NEC 8023, or 
C. Itoh 8510 printer. Just press 
the space bar to see the HELP 
display for instructions. This 
graphics program makes draw- 
ing with the Color Computer 
fun and easy for anyone six 
years and older! 
Price: $21.95 cassette only 

Includes cassette and 

instructions. 
Author: Paul S. Hoffman 
Available: 

Computerware 

P.O. Box 668 

Encinitas, CA 92024 

(714) 436-3512 



Name: GrapfaPowei 

System: Apple n, Apple III, 

IBM PC, DEC 
Memory: 64K 
Language: Pascal 
Hardware: Disk drive 
Description: GraphPower pro- 
duces V-ish-quality business 



graphics at low cost. Using data 
input from the keyboard or the 
Micro-DSS/Finance finanacial 
modeling system, GraphPower 
creates camera-ready graphics 
on paper or transparencies for 
presentations and produces 
graphs and charts including bar, 
stacked bar, side-by-side bar, 
line, pie, text, and reports. 
Features include automatic or 
manual scaling, eight letter 
sizes with five slants, up to four 
graphs per page, multiple image 
overlays, unlimited shading 
combinations, text annotation, 
mathematical operations, 260 
data points, and more. 
Price: $295.00 
Available: 

Ferox Microsystems, Inc. 

1701 N. Ft. Meyer Dr. 

Arlington, VA 22209 

(703) 841-0800 



Name: Diversi-DOSTM 

System: Apple n, Apple n 

Plus 
Memory: 48K 
Language: Assembly 
Hardware: 16K - 128K RAM 

card optional 
Description: Diversi-DOS is a 
new Apple DOS 3.3-compati- 
ble operating system that loads 
and saves BASIC, binary, and 
text files two-to-five times 
faster than standard DOS 3.3. 
Diversi-DOS also contains a 
keyboard type-ahead buffer 
and print-buffer utility. A sim- 
ple, menu-driven, installation 
program is included on the un- 
protected disk. 
Price: $30 by mail order only 

Includes program disk and 

documentation. 
Author: Bill Basham 
Available: 

Diversified Software 
Research, Inc. 

5848 Crampton Ct. 

Rockford, IL 61111 



Name: Stellar Shuttle 

System: Atari 400/800 
Memory: 32K disk, 

16K cassette 
Language: Machine Language 
Hardware: Joystick 
Description: Assigned a dan- 
gerous rescue mission to the 
planet Ttam, you maneuver 
your space shuttle from the 
mother ship and begin a 



perilous descent to the surface, 
attempting to avoid streaking 
asterpods along the way. Retro 
rockets control your rate of 
descent to the narrow landing 
wells on the planet's surface 
where hostages eagerly wait 
for your arrival. The rockets 
also provide your only defense 
against pesky dragons that 
have a taste for Ttamians and 
will do their best to thwart 
your attempt to rescue the 
hostages and transport them 
safely to the mother ship. Four 
different levels of play are 
available. 
Price: $24.95 
Author: Matt Rutter 
Available: 

Broderbund Software, Inc. 

1938 Fourth Street 

San Rafael, CA 94901 

(4151 456-6424 



Name: Veecee-Writer 

System: Apple II Plus, 

DOS 3.3 
Memory: 48K 
Language: Applesoft 
Hardware: Disk drive 
Description: Veecee-Writer 
translates VisiCalc (/PF) files 
for Apple Writer. 
Price: $15.00 

Includes instructions and 

copyable program disk. 
Available: 

Bill Starbuck 

2100 E. Edge wood 

Shorewood, WI 53211 

(414) 963-9750 

Name: Ear Challenger 

System: Apple II Plus 
Memory: 48K 
Language: BASIC 
Hardware: One disk drive 
Description: Instructional les- 
son designed to teach elements 
of music to children or adults. 
Price: $39.95 

Includes documentation and 

diskette 
Author: John M. Eddins and 

Robert L. Weiss, Jr. 
Available: 

Electronic Courseware 
Systems, Inc. 

P.O. Box 2374, Station A 

Champaign, IL 61820 

(217) 359-7099 

(Continued on next page) 



No. 57- February 1983 



MICRO 



101 



Software Catalog (continued) 



Name: 



System: 



Memory: 

Language: 

Hardware: 



Hi-Res Plotting 
Package 

Apple II Plus with 
Applesoft ROM 
(DOS 3.2 or 3.3) 
48K 

Applesoft 
Disk drive, Epson 
printer with 
Graftrax |optional| 
Description: Hi-Res Plotting 
Package features hi-res func- 
tion plotting with a twist. 
Graphs are calculated and 
stored on disk, then viewed in 
rapid succession when the 
game paddle is turned. This 
package makes every Apple an 
oscillosope. A 3-D plotter 
(transparent and hidden line) is 
included along with many 
other useful math routines. 
Price: $19.95 
Includes floppy disk and 
complete instructions. 
Author: William C. Jones 
Available: 
Apex Software Co. 
8781 Troy St. 
Spring Valley, CA 92077 
(619) 466-2200 



Name: Colorcom/E 

System: TRS-80 Color 

Computer 
Memory: 4K - 64K 
Language: Machine Language 
Hardware: ROMpak or 

diskette 
Description: The ColoTCom/E 
is a smart terminal program 
that comes in a ROM cartridge 
ready to plug in and run. 
Features and capabilities in- 
clude on-line and off-line 



scrolling, off-line printing of 
data, receiving and sending 
cassette files, and support of 
any serial printer. Data can be 
easily edited before printing or 
writing to cassette or disk. 
Price: $49.95 

Includes manual. 
Author: Mark Davidsaver 



Available: 




Spectrum 


Projects 


93-1586 Drive 


Woodhaven, NY 11421 


(212) 441-2807 


Name: 


Crossword 




Scrambler 


System: 


Apple m 


Memory: 


128K 


Language: 


Tum-key system 


Hardware: 


Built-in disk drive 




and 80-character 



monitor 
Description: Crossword Sciam- 
blei is an educational software 
product created to teach facts 
and spelling on five different 
subjects with graphically for- 
matted screens and audio out- 
put. User-friendly prompts are 
designed for hands-on experi- 
ence and computer interface. 
Data security concepts and 
password protection are dem- 
onstrated within the programs. 
Price: $39.95 ppd. 

(20% discount to bona fide 

educational institutions) 

Includes diskette and 

documentation. 
Author: David Cortopassi 
Available: 

SOFPROTEX 

P.O. Box 271 

Belmont, CA 94002 



Name: Micro Cookbook 
and Micro 
Barmate 

System: Apple H, Apple H 

Plus; DOS 3.3 
Memory: 48K 
Language: Compiled 

Applesoft BASIC 
and 6502 
assembler 
Description: Micro Cookbook 
and Micio Barmate are 
automated reference systems 
that instantly provide food or 
beverage recipes based on the 
ingredients the user has on 
hand. Drink and food recipes 
are selected via three methods: 
recipe name, category, and/or 
available ingredients. They 
also provide other food- and 
drink-related information — 
nutrition guides, calorie 
counter, party planning, etc. 
Both programs are fast and 
simple to use. 
Price: $30.00 

Includes software, basic 

recipe diskette, 28-page user 

manual, recipe index, and 

ingredient index. 
Author: Joseph W. Butler III 

and Brian Skiba 
Available: 

Virtual Combinatics 

P.O. Box 755 

Rockport, MA 01966 

Name: Computer Slide 
Express 

System: Apple n Plus 
Description: Apple Computer 
owners can convert com- 
puterized charts, designs, 
graphs, and graphics to 35 mm 
slides, prints, or overhead 
transparencies. With our new 
Compute! Slide Express, Apple 



owners simply push a button 
to dial Visual Horizons in 
Rochester, transmit the infor- 
mation over ordinary tele- 
phone lines and receive by 
mail 35 mm color slides, stan- 
dard size black-and-white 
prints, enlargements, or over- 
head transparencies. 
Price: $6.00 each, 

$30.00 minimum 
Available: 

Visual Horizons 

180 Metro Park 

Rochester, NY 14623 

(716) 424-5300 



Name: Computer 

Football Strategy 

System: TRS-80 Models I 
and III, IBM PC 
Memory: 32K - TRS-80 
64K - IBM PC 
Language: BASIC 
Hardware: One disk drive 
Description: Computer ver- 
sion of Avalon Hill's famous 
board game is based on the 
award-winning Sports Illus- 
tiated game of professional 
football. It forces the player to 
constantly make the right 
decisions about his team's of- 
fensive and defensive forma- 
tions. Match wits against the 
computer or against a live 
opponent. 
Price: $21.00 

Includes diskette. 
Available: 

Avalon Hill Microcomputer 
Games 

4517 Harford Road 

Baltimore, MD 21214 



iMCftO 



,TM 



IS THERE LIFE ARER BASIC ? 

YES I WITH. 

COLORFORTH 

MOVE UP FROM BASIC! Forth is a new, high level language available now for the TRS-80® Color Com- 
puter. COLORFORTH, a version of fig FORTH, has an execution time as much as lO to 20 times faster than 
Basic, and can be programmed faster than Basic. COLORFORTH is highly modular which make testing 
and debugging much simpler. COLORFORTH has been specially customized for the color computer and 
requires only 16K. It does not require Extended Basic. When you purchase COLORFORTH, you receive 
both cassette and RS/DISK versions, the standard fig EDITOR and an extensive instruction manual. Both 
versions and 75 page manual $49.95 



Add $2.00 shipping 



DEALER AND AUTHOR INQUIRIES INVITED 



Texas residents add 5 percent 



ARMADILLO INT'L SOFTWARE 
P. O. Box 7661 
Austin, Texas 78712 




1 


MortwOvd 


VKA 


1 



Phone (512) 459-7325 



102 



MICRO 



No. 57 - February 1983 



/MCftO 

Hardware Catalog 



Name: MiciomouseTM 

System; Any 
Description: The Miciomouse 
is a small, hand-held device 
that can be interfaced easily to 
any microcomputer. When the 
mouse is moved on a table top, 
the cursor or pointer moves on 
the computer screen. The 
mouse has two butttons to 
draw lines on the screen. The 
buttons also can be used to 
identify^ move, and position 
symbols. 
Price: $180.00 in single 

quantities, $72.00 in 

quantities above a thousand. 

Includes instruction manual. 

Available: 
3G Company, Inc. 
Rt. 3, Box 28A 
Gaston, OR 97119 
(503) 662-4492 



Name: HypeicartridgeTM 

System: Atari 400/800 
Memory: 16K 
Description: Hypeicaitiidge 
gives hobbyists the ability to 
make their own cartridges at 
home. Software firms can 
market extensive ROM-based 
cartridges for use with 8K 
RAM (or more) computers 
without disk drives. It comes 
with four low-profile sockets 
for 24-pin ROMs or EPROMs 
(chips not included), two pin- 
select logic chips, and a 
capacitor. Hypeicaitiidge can 
be used in two configurations: 
with any combination of 2532 
EPROMs and 2332 ROMs; or 
with two Atari ROMs and two 
2532 EPROMs or 2332 ROMs. 
Price: $39.00/unit; quantity 
discounts available. 
Includes configured cartridge 
without EPROMs/ROMs 

Available: 
ChameleonTM Computing 
Dept. of Physics and 

Astronomy 
Box 119-P 
Dickinson College 
Carlisle, PA 17013 
(717) 245-1717 

Name: Computet Practice 
Keyboard 

System: Any 
Description: The printed key- 
board is used to practice 
special function-key locations 



and to become familiar with 
all popular computers. 
Price: $9.95 each 

Includes shipping and 

handling. 
Available: 

Computer Practice Keyboard 
Company 

616 9th St. 

Union City, NJ 07087 

Name: Ink Stick 
Description: Ink Stick mounts 
inside most spool ribbon- 
dependent printers that use 
Vi ' ' spool ribbons and immedi- 
ately replaces ink that is 
depleted from the ribbon to 
maintain an appropriate level 
of ink in the ribbon at all 
times. This extends the life of 
the ribbon frabic, reduces the 
operating cost of the printer, 
provides the user with consis- 
tent image density, and 
reduces the number of times 
ribbons are handled. 
Price: $4.95 retail 
Includes mounting cap, 
%-oz. ink in container, 
applicator wick, and 
installation instructions. 
Available: 
Lawrence Electronics 
3651 N. Cicero Avenue 
Chicago, IL 60641 

Name: Sage n 

System: Sage II 
Language: Pascal, FORTRAN, 
BASIC, Assembler 
Description: Sage II offers the 
highest performance-per-dollar 
computer on the market in the 
price range of the IBM/ Apple 
ni, but with four to twenty 
times more computing power. 
Expansion capability includes 
more RAM, multi-user multi- 
tasking, hard drives, networks, 
and graphics. 

Price: $4,450.00 
Includes 128K RAM, 320K 
floppy, televideo 925 term, 
software 

Available: 
Sage Computer Technology 
35 N. Edison Way, Suite 4 
Reno, NV 89502 



Name: Data VaultTM 

Description: Date Vault pro- 
tects your computer tapes. 



disk cartridges, and floppy 
disks from the hazards of ship- 
ping and storage. They feature 
a rugged polyethylene exterior, 
internal shock-absorbing 
foam, and a positive-action 
locking, system. Send for a 
catalog. 
Available: 

Kathy Sutherland 

Sales Manager 

Data Vault Division at 

PRC of America 

475 Boulevard 

Elmwood Park, NJ 07406 

(201) 796-6600 



Name: ITALKII Speech 
Synthesizei 

System: Atari 400/800 
Memory: 16K 
Language: BASIC 
Description: ITALKII offers an 
unlimited vocabulary, four 
voices, and powerful program 
development utilities. It re- 
quires no external power sup- 
ply and outputs speech to the 
monitor's speaker. A machine- 
language driver allows ITALKII 
to speak while action graphics 
and sound effects are being ex- 
ecuted. Software includes a 
dictionary, a word editor, a 
sentence builder, and Woid- 
blastei (an arcade-style educa- 
tional game). 
Price; $199.00 
Includes ITALKII, disk or 
cassette, manual, phonetic 
speech dictionary. 

Available: 
Greenbrier Marketing 
International, Inc. 
509 South 48th St. 
Suite 105 
Tempe, AZ 85281 
(602) 948-0005 



Name: Starfighter, 

The Ultimate 
Joystick 

System: Atari VCS, Atari 
400/800, 
Commodore VIC, 
Sears Tele-Game 
Description: This joystick con- 
troller is designed with an ad- 
vanced mechanism that trans- 
fers movement directly from 
the user's hand through case- 
hardened steel components to 



the internal contacts. Its 
rounded shape helps to elimin- 
ate muscle fatigue when using 
other joysticks for long peri- 
ods. Controller carries a two- 
year limited factory warranty. 
Price: $16.95 
Available: 

SUNCOM, Inc. 

270 Holbrook Dr. 

Wheeling, IL 60090 



Name: Color HI 
System: TRS-80 Color 

Computer 
Memory: 4K - 64K 
Description: If you are a do-it- 
yourselfer then you can 
upgrade a color computer to a 
65-key keyboard with numeric 
pad, integrated television and 
computer display screen, 
telescopic antenna, internal 
disk and sound, channel selec- 
tor knob, indicator lamps, 
ROM pack slot, and all I/O 
connector jacks mounted in a 
Model III enclosure. Color 
Computer products work as 
before. 
Price: $15.00 

Includes instruction manual, 

12 professional drawings and 

templates, bill of material, 

check-off list, and 

manufacturing list. 
Available: 

L & E Electro Sales Co. 

7017 Hazehine Ave #10 

Van Nuys, CA 91405 

(213) 994-3110 



Name: Joypoit 

System: Apple n or Apple 

nPlus 
Description: Joypoit expands 
the game port to use four fully 
functional Apple-compatible 
paddles and two Atari-type 
joysticks. No modification is 
necessary. The Joyport simply 
plugs into the existing game 
I/O port. 

Price: $49.95 
Includes user's manual. 

Available: 
Sirius Software 
10364 Rockingham Drive 
Sacramento, CA 95827 



JMCftO 



No. 57 - February 1983 



MICRO 



103 



JMCRO 

6809 Bibliography 



Dr. William R. Dial 
438 Roslyn Avenue 
Akron, OH 44320 



101. 80 Micro (October, 1982J 

Miller, Franklyn D., "The Colorful Computer — Part III," pg. 

254-260. 
A number of program listings for those without Extended 
Color BASIC in their TRS-80 Color Computer. 

Degler, Roger L., "LP VII Patch for the CO," pg. 304-306. 
An eight-bit printer-driver for the 6809-based Color Computer. 

102. Popular Electionics 20, No. 10 (October, 1982J 

Anon., "6809 FORTRAN," pg. 42. 
Running under FLEX and UniFLEX, this compiler complies 
with ANSI FORTRAN-77 subset of FORTRAN. 

103. Call — A.P.P.L.E. 5, No. 9 (September, 1982J 

Anon., "Enhancement to The Mill," pg. 75. 
MSM is an enhancement to The Mill Assembler Develop- 
ment Kit that combines the features of ASM09, 
ASM09IO.BIN and LOAD09. Thus, a stand-alone MSM09 
BRUNable 6809 assembler. 

104. Personal Computer World 5, No. 9 (September, 1982) 

Anon., "Dragon 32," pg. 40-41. 
The Dragon 32 is a 6809-based personal computer, 32K RAM, 
nine colors, high-resolution graphics, etc. 

105. Commodoie Microcomputer Magazine 3, No. 4 (August/ 
September, 1982) 

Kutz, Walt, "SuperPET Update," pg. 14. 
COBOL for the 6809-based SuperPET, using extra memory, 
single board upgrade (8032 to SuperPET), accessing the serial 
port, etc. 

Staff, "Commodore News," pg. 21. 
Everything you always wanted to know about the 6809-based 
SuperPET — and asked! Questions and answers. 

106. The Rainbow 2, No. 3 (September, 1982) 

Lester, Lane P., "An Electronic Gradebook Can Make '82-'83 
Much Easier," pg. 8-14. 

A program for the TRS-80 Color Computer-equipped teacher. 
Walrath, Del, "Let's Learn How To Do a Number-Picking 
Game," pg. 18-20. 

A programming tutorial using a number-memory game. 
Nolan, Bill, "Demons in the Dungeon? Let's See 'Em All," pg. 
22-32. 

A program to get quick information about a particular kind of 

demon without looking it up. A TRS-80 Color Computer 

dungeon game utility. 

Harpe, David, "PUT, GET and Random Forms Make for 
Unusual Graphics," pg. 32-33. 

A graphics program for the 6809-based Color Computer. 
Blyn, Steve, "Make the Difficulty Level Variable," pg. 35-36. 

Suggestions and an illustrative listing for CAI programs on 

the 6809-based TRS-80 Color Computer. 
Hryzak, Wolfgang, "Ping-Pong International Game for People 
and 80C," pg. 41-43. 

A German game for the 6809-basd Color Computer. 
Roslund, Charles J., "An Automatic Key Repeat Feature is 
Handy to Have," pg. 47-49. 

Add auto-key repeat to your Color Computer with this 

machine-language routine. 
Schmidt, Jim, "Here Are Some Useful Utilities for Your Use," 
pg. 51-53. 

Utilities for the Color Computer include a line-width driver, 

an 8-bit graphics driver, and a speed routine. 



Rosen, Bob, "The Simple Way to 64K," pg. 59. 

A hardware modification to convert the 6809-based Color 

Computer to 64K. 
Hine, Al, "The Track Will Provide Hours of Varied Fun," pg. 
60-70. 

A race game for the 6809-based Color Computer. 

107. 80-U.S. Journal 5, No. 10 (October, 1982) 

Beste, Steve Den, "Word Processing on Your Color 
Computer," pg. 65-74. 

A line-oriented text editor for the TRS-80 Color Computer 

with disk. 
Fawcett, Dale H., "Serial Printer Interfacing," pg. 95-97. 

Coimecting to your 6809-based Color Computer. 

108. MICRO No. 58 (October, 1982) 

Whiteside, Tom, "Apple Pascal P-Code Interpreter and the 

6809," pg. 79-84. 
A rewrite of the Apple UCSD Pascal P-Code interpreter for 
the MC6809 shows code size and speed improvements. 

Tenny, Ralph, "A Homespun 32K Color Computer," pg. 91-95. 
A hardware article detailing a relatively simple memory ex- 
pansion from 16K to 32K in the Color Computer. 

109. Microcomputer Printout 3, No. 11 (October, 1982) 

Preston, Chris, "MicroScope," pg. 20-21. 
Multiple processors and how they work including 6502/Z80, 
6502/6809, and similar combinations. 

110. Compute! 4, No. 10 (October, 1982) 

Anon., "TRS-80 Color Computer Program," pg. 223. 
Colortext for the 6809-based TRS-80 Color Computer is a 
high-resolution text driver that displays a variety of character 
fonts and graphics on the screen simultaneously. 

111. Personal Computer 5, No. 10 (October, 1982) 

Oliver, Roger and Sadler, Chris, "Positron 9000," pg. 128-134. 
The Positron is a new British-made microcomputer using 
6809 with 64K RAM. 

112. '68 Micro Journal 4, Issue 10 (October, 1982) 

Ney, Robert L., "Color User Notes," pg. 11-13. 

Discussion of F-MATE Version 2.0, powerful business 

systems for the TRS-80 Color Computer, etc. 
Commo, Norm, " 'C User Notes," pg. 14-19. 

Discussion of Intersoft Version 1.0, a small C compiler for 

the 6809. 
Watson, Ernest Steve and Brady, F. Dale, "Home Accounting 
Program," pg. 20-23. 

Part in of an accounting system for 6809 systems. 

113. The Rainbow 2, No. 4 (October, 1982) 

Ridge, Herbert B., "Pope Gregory Would Like This Calendar," 
pg. 8-12. 

A calendar program for the TRS-80 Color Computer. 
Inman, Don, "Let's Learn How to Use Graphics with CoCo," 
pg. 14-17. 

A graphics tutorial for the 6809-based Color Computer. 
Garrett, Ron, "Key Checks to Various Accounts with This Pro- 
gram," pg. 20-24. 
A Color Computer program to allow you to designate spend- 
ing areas for a check or payment into different categories for 
business expenses. _ 

JMCftO 



104 



MICRO 



No. 57 - February 1883 



Language Packages 



# 



Editor's Note: This list of Language Packages is 
not meant to be comprehensive. 



Ada 










^^H 


68000 


Ada Compiler 


TeleSoft 


q-Bus, Multi-bus, S-100 configurations 


$250 


^^H 


Z80, 8080, 


Ada 


Supeisoft 


CP/M, MSDOS, 32K RAM min. 


$350 


^^^H 


8086, 8088 










^^^1 


APL 










^^M 


Apn 


APL 


Vanguard 


Z80 softcard, RAMcard, 1 drive, 48K 


$500 


^^M 


BABBLE 










^^ 


Ap n 


BABBLE 


Software Factory 


16K cass/32K disk 


$15 Icass) 




CEEMAC 








$20 (disk) 1 
1 


J g 

)QfQ 


Ap n/n 


CEEMAC 


Vagabondo 


48K 


$75 1 


COBOL 








i 


Ap n/n Plus 


COBOL-30 


Microsoft 


2 drives/44K/Softcard 


$750 








Enterprises 






OSI 


COBOL 


Prism Software 






6809, 68000 


RM/COBOL 


Ryan-McFarland 


Unix(68000], 8 disk, 1 drive, 64K (6809) 


$750 - §• ^ 
$1250 S, fP 

$600 03 13 






Data Compass 
Corp. 
OSI 




OSIC-3 


COBOL 3.3 


CP/M 


Ap n/n Plus 


Nevada COBOL 


EUis Computing 


Softcard, CP/M, 1 drive 


$29.95 -■ fti 

$850 o jr 

$29.95 ^ LL 

<D org 

; « 
3 en 


6502 


CIS COBOL 


MicroFocus 


UNIX or CP/M 


Apn/n 


Nevada COBOL 


FORTH, Inc. 


Softcard, CP/M, 1 drive 


COMAL-80 








PET 


COMAL-80 [best 


Metanic 


CP/M 




of BASIC & 








Pascal) 






FOCAL-65 












ApD,SYM, 


Fast FOCAL-65 


6502 Program Bxchange 


48K, 1 drive (Apple), 16K, cassette (others) 






AIM, OSI, KIM 










j^^^ 


FOUO 










^H 


KIM-1 
FORTE 


FOLIO 


Soft Corp 




$50 

cass $3 extra 


H 


Apn 


FORTE 


SofTape 




$29.95 


^1 


w/Intener 










^^H 


FORTH 










^^M 


Ap n/n Plus 


TransFORTH n 


Insoft, Inc. 


1 or more disk drives/48K/DOS 3.3 


$125 


^^H 


At 


fig-FORTH 


Atari 


lOK 




^^^1 


Ap n/n Plus 


FORTH 
(Microspeed, 
superset of 
FORTH) 


Applied Analytics, Inc. 


4KRAM 


$495 (2 MH2) 
-u Speed E 
$645 (4 MHz) 
-u Speed H Plus 


■ 


Ap 


SuperFORTH 


Hayden Software 


48K/DOS 3.2 


$49:95 disk 


^^^H 


TRS-80C 


CC FORTH 


Frank Hogg 


Disk drive 


$99.95 


^^^H 


Apn/n 


FORTH 72 
Version 2 


MicroMotion 


1 disk drive 


$89.95/ 
$139.95 hi-res 
& floating point 


H 


6809 


FORTH 6809 


Talbot Microsystems 




$100 


^^^H 


SYM-1 


SYM-FORTH 1,0 


Saturn 




$135 


^^^H 


6502 


fullFORTH 


CGRS Microtech 




$65 


^^^H 


Apn/n 


FORTH-79 


MicroMotion 


1-6 disk drives, 48K, 80 column bd. optional 


$99.95/ 

$139.95 with 
•' floating point 

& hi-res 


■ 


OSI 


Stand-Alone 
fig-FORTH 


FORTH Tools 




$49.95 


^1 


68000 


PolyFORTH 






$5100-8200 


^^^H 


6809 


X-FORTH 


Frank Hogg 


FLEX, disk drive 


$129.95 


^^^H 


COM-64 


C64 FORTH 


Performance Micro 
Products 




$79.95 cass/ 
$99.95 disk 


^H 


VIC-20 


VIC FORTH 


HES 




$59.95 


^^^H 


Ap n/n Plus 


FORTH 1.7 


Information Unlimited 


1 disk drive, 48K, Ap DOS 3.2 


$140 


^^^H 


Ap 


FORTH I, n 


SofTape 


1 drive 


$49.95 


^^^H 


OSI-C3, 4, 


S-FORTH 


Aurora 


20K 


$34.95 (OS65 


^^^H 


OS65D-3 








D-3(, $49.95 
with source 
listing 


H 


Apn/n 


GraFORTH 


Insoft, Inc. 


48K, 16K RAM card recommended, DOS 3.3, 1 drive 


$75 


^^^H 


PET 


FORTH 


AB Computers 


16K or 32K, PET/CBM disk drive 


$50 


^^^H 


Apn/n 


Timin FORTH 3.5 


Lifeboat Assoc. 


Z-80 Softcard, CP/M or CDOS, 32K min., 2 drives 


$250 


^^^H 


TRS-80C 


Color-FORTH 


ArmadiUo Int'l. 
Software 


16K 


$49.95 


^H 


KIM 


FORTH 


Eric C. Rehnke 




$90 cass/$7S 
source code 
only 

$109.95 


H 


TRS-80C 


Color-FORTH 


MicroWoiks, Inc. 


4K 


^H 



Language Packages will be continued in next month's issue. 

JUCRO" Information Sheet #1 



Language Packages 



w 



Addresses 

AB Computers 

252 Bethlehem Pike 

Colmar, PA 18915 

215-822-7727 
Abacus Software 

PO Box 7211 

Grand Rapids, MI 49510 

616-241-5510 
Addison Wesley 
Publishing Co. 

Jacobs Way 

Reading, MA 01867 

617-944-3700 
Apple Computer, Inc. 

Software Division 

10260 Bandley Drive 

Cupertino, CA 95014 

516-751-5139 
Applied Analytics, Inc. 

8235 Penn Randall Place, 
Suite 202 

Upper Marlboro, MD 
20972 

301-420-0700 
Armadillo International 
Software 

PO Box 7661 

Austin, TX 78712 

512-459-7325 
ATARI Home Computers 

1265 Bonegas Ave. 

Sunnyvale, CA 94086 

800-538-8543 
408-745-2100 
Aurora Software Assoc. 

378. Mitchell 

Arlington, IL 6005 

312-259-3150 
CCRS Microtech 

PO Box 102 

Langhome, PA 19047 

215-757-0284 
Commodore Business 
Machines, Inc. 

681 Moore Rd. 

King of Prussia, PA 19406 

215-6987-9750 
Compu/Think 

965 West Maude Avenue 

Sunnyvale, CA 94025 

408-245-4033 
Computerware 

PO Box 668 

Encinitas, CA 92024 

619-436-3512 
Creative Solutions 

4801 Randolph Rd. 

Rockville, MD 20852 

301-9844-0262 
Datasoft, Inc. 

19519 Business Center 
Drive 

Northridge, CA 91324 

213-701-5161 
Duggers Crowing Systems 

POB 305 

Solano Beach, CA 92075 
Dynasoft Systems, LTD 

P.O. Box 51 

Windsor Junction 

Nova Scotia, CANADA 
BON 2V0 

902-861-2202 



Ellis Computing 

3917 Noriega Ave, 

San Francisco, CA 94122 

415-753-0186 
Eric C. Rehnke Technical 
Services 

1067 Jadestone Lane 

Corona, CA 91720 

714-371-4548 
FORTH, Inc. 

2309 Pacific Coast 
Highway 

Hermosa Beach, CA 90254 

213-372-8493 
FORTH Interest Croup 

POB 1105 

San Carlos, CA 94070 

415-962-8653 
Frank Hogg Laboratory 

130 Midown Plaza 

Syracuse, NY 13210 

315-474-7856 
Gnosis 

4005 Chestnut St. 

Philadelphia, PA 19104 

215-387-1500 
Hoyt Steams Electronics 

413E Cannon Dr. 

Phoenix, AZ 85036 
Human Engineered Software 

71 Park Lane 

Brisbane, CA 94005 

415-468-4116 
Information Unlimited 
Software, Inc. 

281 Arlington Ave. 

Berkeley, CA 94707 

415-525-9452 
Insoft, Inc. 

10175 S.W. Barbur Blvd. 

Suite 202B 

Portland, OR 97219 

503-244-4181 
JRT Systems 

1891 23rd. Avenue 

San Francisco, CA 94122 

415-566-5100 
Kenyon Microsystems 

3350 Walnut Bend 

Houston, TX 77042 

713-978-6933 
Keyser Enterprises 

22 Clover Lane 

Mason City, lA 50401 
Krell Software 

21 Millbrook Dr. 

Stony Brook, NY 11790 

516-751-5139 
Lifeboat Associates 

1651 Third Ave. 

New York City,NY 10028 

212-860-0300 
Lucidata 

POB 128 

Cambridge CB2 5EZ 

England 
Merrimack Systems 

PO Box 5218 

Redwood City, CA 94063 
Metanic ApS 

Kongevejen 177 

DK-2830 

Virium, Denmark 



Micro Focus, Inc. 

1601 Civic Center Drive 

Santa Clara, CA 95050 

408-496-0176 
Micro Motion 

12077 Wilshire Blvd. 506 

Los Angeles, CA 90025 

213-821-4340 
Micronetics Design Corp. 

932 Hungerford Dr., 
Bldg. 11 

Rockville, MD 20850 

301-424-4870 
Microsoft 

400-108th Ave. NE 

Bellevue, WA 98004 

206-828-8080 
MicroWorks 

POBox 1110 

Del Mar, CA 92014 

619-942-2400 
Muse Software 

347 N. Charles Street 

Baltimore, MD 21201 

301-659-7212 
Omega Software 

POB 70265 

Sunnyvale, CA 94086 

408-733-6979 
On-Going Ideas 

RDl, Box 810 

Starksboro, VT 05487 

312-259-3150 
On-Line 

37575 Mudge Ranch Rd. 

Coarsegold, CA 93614 
Ohio Scientific Instruments 

7 Oak Park 

Bedford, MA 01730 

617-275-4440 
Prism Software 

PO Box 928 

College Park, MD 20740 
Quality Software 

6660 Reseda Blvd., 
Suite 105 

Reseda, CA 91335 

213-344-6599 
Querty Computer Systems 

20 Worcester Rd. 

Newton Hall, Durham 

England LI.25 67045 
Radcliffe House 

66-68 Hagley Rd. 

Edgbaston, Birmingham 

United Kingdom B16 8PF 
Radio Shack Educational 
Software Division 

400 Atrium, 
One Tandy Center 

Fort Worth, TX 76102 

817-390-3302 
Ryan-McFarland Data 
Compass Corp. 

3233 Valencia Ave. 

Aptos, CA 95003 

408-662-2522 
Saturn Software Limited 

8246 116A Street 

Delta, British Columbia 

CANADA V4C 5Y9 



6502 Program Exchange 

2920 W. Moana 

Reno, NV 89509 

702-825-8413 
Softcorp 

1372 East 52nd. St. 

Chicago, IL 60615 
SofTape Software Exchange 

10432 Burbank Blvd. 

North Hollywood, 
CA 91801 

213-885-5763 
SofTech Microsystems, Inc. 

16885 West Bernardo Dr. 

San Diego, CA 92127 

714-942-1727 
Software Factory 

PO Box 904 

Chatsworth, CA 91311 
Sorcim 

1333 Lawrence Expess- 
way. Suite 148 

Santa Clara, CA 95051 

408-727-7634 
Succinct Systems 

1346 River St. 

Santa Cruz, CA 95060 

408-426-4197 
SuperSoft 

PO Box 1628 

Champaign, IL 61820 

217-359-2112 
Tallgrass Technologies Corp. 

9009 W. 95th St. 

Overland Park, KS 66212 

913-381-5588 
Tamarack 

Water St. 

Darby, MT 59829 

406-821-4596 
Telesoft 

10639 Roselle St. 

San Diego, CA 

714-457-2700 
Tenapin, Inc. 

678 Mass. Ave., 205 

Cambridge, MA 02139 

617-492-8816 
Vagabondo Enterprises 

1300E. Algonquin-35 

Shawnburg, IL 60195 

312-397-8705 
valFORTH International 

3801 E. 34th St. 

Tucson, AZ 85713 

800-528-7070 
Vanguard Systems, Corp. 

6901 Blanko 

San Antonio, TX 78216 

512-340-1978 
Volition Systems 

POB 1236 

Del Mar, CA 92014 

619-481-2286 
Williamsville Publishing Co. 

Box 250 

Fredonia, NY 14063 
Wordsworth 

PO 28954 

Dallas, TX 75228 

214-783-0419 



i 



i 



JUGRO" Information Sheet #1 



NIBBLE EXPRESS Vol. I 

TABU OF CONTENTS 



EDITORIAL 

APPLE TRAC — Personal Finance Management by Mike i 
SORT 'EM OUT — Principles of Sorting by NIBBLE Staff 
PSEUDO UTO-START — Reset with CTRL Y by Rick Con 
INITIALIZE NEW FILES WITH ONERR GOTO by NIBBLE 
MACHINE LANGUAGE SCREEN DUMP by R.M. Mottola 

FREE? DISK SECTORS by Chuck Hartley ..... . . . . 

HI-RES SPACE MAZE — Graphics Game by NIBBLE Staf: 
UN-GRAPHIC GRAPHIC PRINTING by NIBBLE Staff . . . 
TABLE PRINTING MADE SIMPLE! by A//ee/.E Staff ..... 
DYNAMIC ARRAY DIMENSIONING by NIBBLE Staff .... 

BLOCKING VERY LARGE FILES by NIBBLE Staff 

LOW RESOLUTION SHAPEWRITER — High Speed Actio 
SPACE ANIMATION — Add ZIP to your Games by NIBBL 
STAR ATTACK — Fast Hi-Res Conflict Game by Mike Hai 
PADDLE READING IN ASSEMBLY LANGUAGE/)/ W/eSi 
FIRINO^I^iS ja^'Ji^ ^irgrMiMli Control by NIBt 
AIRSlQJEB-f-jJntl^mwprprce Maneuvers b 
AUT(^^^^m^^\§fb§^^U0by NIBBLE Staff 
WATCH OUT FOR GRAPHICS OVERFLOW by Mike Harv 

TOUAkfmt^tiWMEmEtMmi^Mimtlleynolds til 
TOU(irFllDmil#talL/i|:El>lrimV^Wam Reyno. 
DOU BL&TRIPLEy'AWP MOWC OVgB P WIN T IWG by NIBBL 

ARROWS AND CONTROL CODES by NIBBLE Staff 

APPLE TRICKS — Fast DOS/Spcl Chars/Unlistables toy C 
APPLESOFT VS. INTEGER BASIC PERFORMANCE by /*. 
APPL^^ Paoer Tiger Graohics by Mike Harvey ....... 

FAST ipaaji^SXINfi AND SALES TRENDING by Mike h 
SUPEm^Ki^^F^MM^es Weaving Design by Alexandei 
FOOTB^I.^^oll»Grid-lron Action by Lou Haehn . . 
BUILJdOAOSY^ICKS FOR UNDER $15.00 by NIBBL 
BUILEUUKBUq^i^E^A^IiaaL IMITgi- MBBLE Staf 

DISK W^mimmTi%^amMcgmfmmm nibble 

APPL|TRliKl-^^lif|x|Ftl#nilli|fiST by Crs 
PIP I — Personal Inventory Program on Tape by Rick Con 
FUN Vf THAMl|«MI|-M-n! BfM^M^by Craig Cn 

PIP II I- Pll UteB CKccltlM^andli^.l 

PASsliaWflMBLls ■ |pmA|Mlr%riRlC byR.M. Mt 
MANAGING AND MOVING DISK BUFFERS by William Ri 
MONITOR EXECUTION — Basically by William Reynolds 
AMPER-INTERPRETER — Add Print-Using and Much Mo 
FUN WITH ASSEMBLER — Graphics by Alexander Laird 
STRING FUNCTION FOR INTEGER BASIC by William Re 
BASIC/MACHINE LANGUAGE SUBROUTINE CREATOR 
CHR$ FUNCTION FOR INTEGER BASIC byWiftiamReyn 
FUN WITH ASSEMBLER — Alpha/Beeper by Craig Cross 
APPLE A.I.M. — Automated Intelligent Mailing by W/cAaei 
APPLE CONCORDANCE — Track Variable and Line #'s b 

LOW SCORE II — Strategy Game by Rudy A. Guy 

HOW TO WRITE GAMES THAT LAST by Mike Harvey . . . 
IMPROVING THE MULTIPLE ARRAY SORT by fl/c/f Com 
APPLE UPPER/LOWER CASE PRINTING by Mike Harvey 
WILL O' THE WISP — High Adventure by Mark Capella . . 
NIFFUM — DOS 3.3 to 3.2 Conversion by C.J. Thompson 
BLAST AWAY! — Lo-Res Shooting Gallery by Andrew Be. 
FUN WITH MONITOR — How to Enter Assembly Languac, 



nibble 




ORDER NOW 

All programs and Articles are 
centered on the Apple Computer 
family. 



NIBBLE 

P.O. Box 325 
Lincoln, MA 01773 

Yes) t want NIBBLE EXPRESS Vol. 1 in my library' 
Here's my D Check D Money order 

for $12.95 plus $1 75 postage/handling. (Outside U S 
add $2.75 Surface Mail or $5 00 Airmail.) 

• *' * 

O Alsasehd me NIBBLE EXPRESS Vol 2 at$14 95 plus 
$t 75 postage/handling (Outside U.S add $2 75 Sur- 
face Mail or $5 00 Airmail.) 



Master Card & Visa Accepted 



Card # _ 

PLEASE PRINT GLBIRLY 

Signature 

Telephone 

Name 



Expires . 



Street 
City _ 



.State. 



.Zip_ 



Your check oi immy unhr miisl acanipiii|rimir order ta 
qualify 

Qutsids U.S - dwcks niMt In ttam m i U.S. Bank. 
*A|ipl« IS a ragiitand tiadamark of Anila Computer 
Company 



Page 

3 
7 

17 

17 

18 

18 

19 

22 

23 

24 

26 

26 

31 

35 

37 

38 

39 

47 

50 

50 

53 

58 

59 

59 

59 

60 

65 

69 

73 

77 

78 

83 

89 

93 

97 

98 

99 

101 

103 

106 

113 

119 

120 

121 

123 

133 

135 

135 

135 

136 

139 

147 

153 

157 

158 

159 

161 

169 

171 

174 



If you're looking for quality software at an 
outrageously reasonable price, we have 
a message for you... 



Apple^*^ owners: 



10 HOME: P$ = "GZPV UREV WLOOZIH LUU HLUGHRWV":VTAB12: 
HTAB6: FOR P = 1 TO LEN(P$):J » ASqMID$<P$,P,1)):PRINT 
CHR$<ABS<(155*(J >64))-J));: NEXT:PRINT 



TRS-80'owners: 



10 CLS: DEFINT A-Z: PRINT@529,;: P$ = "GZPV UREV WLOOZIH 
LUU HLUGHRWV": FOR P = 1 TO LEN(P$):J = ASqMID$<P$,P,1)): 
PRINT CHR$<ABS<(155*(J>64)) + J));: NEXT:PRINT 



y\ 




ATARr owners: 



10 GRAPHICS 0:DIM P$(30):P$ = "GZPV<UREV< 
WLOOZIH<LUU<HLUGHRWV":FOR P = 1 TO 30: 
?CHR$<155-ASqP$(P)));: NEXT P:? 






ype 



7>)> 



Take a close look at the message above. If you own an 
APPLE™, an ATARI®, or a TRS-80* microcomputer, you 
probably rejbognlze the language. 

It's in BASIC.a one-line program you can type into your 
computer to find out how much money you can save on a 
one-year subscription to a unique, useful, entertaining 
software magazine...So(tSlde. 

Sure, we know this Is a rather unconventional way to In- 
troduce you to So(tSlde...but once you know what our 
magazine is all about, we know you'll agree that It's a 
rather unconventional publication. 

You see, each month, between the covers of SoftSlde 

And right now you can pay 
even less than $24 for the next 
12 issues of SoftSide iViagazine! 

It's easy! Just type the one-line of code we've prepared 
for your system (above) into your APPLE™, ATARI® or 
TRS-80* microcomputer. Then type "RUN," and the 
unscrambled message on your monitor will tell you how 
much you can deduct from SoftSlde's already low 
subscription price of $24. 

Fill In the coupon below and send it along with your 
payment and we'll send you the next 12 Issues of SoftSlde 
Magazine! 



we publish some of the most exciting games, practical 
utilities, and captivating adventures you'll find 
anywhere. ..at any price! 

SoftSlde publishes original programs, written by some 
of the most Important names in the software business. 
Over half of each issue Is devoted to BASIC line listings 
for programs you can type into your computer and enjoy 
forever. Programs that might cost you hundreds of dollars 
if you purchased them Individualiy at your computer store, 
but actually cost you just a few cents each because of 
SoftSlde's low, one-year subscription price of just $24. 




_5oft5i3e. 



Coded Bonus Offer 



Your Order * Reg. Price 

a 12 Issues Of SoftSide Magazine $24/yr. 

Send me the D APPLE™, D ATARI®, D TRS-80® Version 

(Please check one) 

If you do not use the coded offer, simply pay tfiis amount. You still 
save 1/3 off tfie newsstand price. 

n Yes, SoltSlde Is tfie one computer software magazine I can't 
afford to be without. 

Name 




Address 

City/State 



YOU PAY ONLY 

(Enter Amount) 



Send to: 

SoftSide Publications, Inc. 
Dept M65 
6 South Street 
Mllford, NH 03055 



D Payment Enclosed D Bill me 

D Check D Money Order D MasterCard D VISA 

Name of Cardholder 



-Zlp- 



MCfand lnterbank«/VISA«_ 

Exp. Date 

Signature 



PASCAL 



• 



Q. 

S) (a 

? o 

S) (a 
"■ >< 

3 3 
O 



rS f^ A 

_ <= 3] 

m ^ 1^ 



W 



O 

^* 
S) 

(Q^ 0) 
S B 

Q. -« 
<D _ 

f o 

?■ I 

o 0> 

? 5 

<D -1 
"■ <0 
CL i3 

B £. 

<? 5 

Pi 






O 



\A/ 



9 



A 



z 

D 







V^ 



:3 

m 

w 



6 



A 







^ 





■o c 

II 

0] 



W W H 

O 3- 

01 03 (D 
(0 



3 » »^^ 



5Jc 



3 d 03 
(Q(Q Q- 



CO 

c 
■o 

"O 03 

=: CO _ 
<t» o 3 

Q. 05 _ 

-, — CO CD 

ills 

3 Q. CD ^ 
CO ^ CD 

3- CD 2,C 

CD —' 



CO 



<tj oj » <5 

T'CDCO^ 

c 

^3 

3 

03 

n' 

CD 



3 CD 
H CD « 

® 3 «■ 



o 

CD 

03 03 03 

§850 

CD 03 c; S 
« 5" o =■• 

CD (O 0(Q 



w 



w 



e 



^ 



1 



o 



Q 



9 



© 



s A A 




ilMOK)' Data Sheet #13 



PASCAL 




I 








• 



A 




V 



' T 



• 






E 



Q9 







iMCftO" Data Sheet #13 



NATIONAL 

ADVERTISING 

REPRESENTATIVES 



WEST COAST 

The R.W. Walker Co., Inc. 

Gordon Carnie 

2716 Ocean Park Boulevard 

Suite 1010 

Santa Monica, California 90405 

(213) 450-9001 

serving: Washington, Oregon, Idaho, Montana, Wyom- 
ing, Colorado, New Mexico, Arizona, Utah, Nevada, 
California, Alaska, and Hawaii (also British Columbia 
and Alberta, Canada). 

MID-WEST TERRITORY 

Thomas Knorr & Associates 
Thomas H. Knorr, Jr. 

333 N. Michigan Avenue 

Suite 707 

Chicago, Illinois 60601 

(312)726-2633 

serving: Ohio, Oklahoma, Arkansas, Texas, North 
Dakota, South Dakota, Nebraska, Kansas, Missouri, 
Indiana, Illinois, Iowa, Michigan, Wisconsin, and 
Minnesota. 

MIDDLE ATLANTIC AND 
SOUTHEASTERN STATES 



Advertiser's Index 



Dick Busch Inc. 
Richard V. Busch 

6 Douglass Dr., R.D. #4 
Princeton, NJ 08540 
(201) 329-2424 



Dick Busch, Inc. 
Eleanor M. Angone 

74 Brookline 

E. Atlantic Beach, NY 11561 

(516) 432-1955 



serving: New York, Pennsylvania, New Jersey, Dela- 
ware, Maryland, West Virginia, Virginia, D.C., North 
Carolina, South Carolina, Loulsianna, Tennessee, Mis- 
sissippi, Alabama, Georgia, and Florida. 

NEW ENGLAND 

Kevin B. Rushaiko 

Peterboro, New Hampshire 03458 
(603) 547-2970 

serving: Maine, New Hampshire, Vermont, Massachu- 
setts, Rhode Island, Connecticut, and Kentucky. 

ADVERTISING MANAGER 

Cathi Bland 

address materials directly to: 
MICRO INK, Advertising 
34 Chelmsford Street 
Chelmsford, Massachusetts 01824 
(617)256-5515 



Aardvark Technical Services, Ltd 39 

ABC Data Products. 24 

Acorn Software Systems 84 

Alternative Energy Products 84 

Anthro-Digital Software 18 

Armidiilo Software 102 

A2 Devices , .63 

Aurora Software 27 

Chameleon Computing 53 

Commander Micro Systems Specialties 20 

Compu Sense 14,16,49,79,93 

CompuTech 70 

Computer Case Co 91 

Computer Mail Order 56-57 

Computer Science Engineering 24 

Datamost, Inc IPC, 77 

Digital Acoustics 61 

Execom, Inc . . . 70 

Gimix, Inc 1 

Gloucester Computer Bus Co 79 

Gnosis 64 

Gooth Software . . 15 

Hayden Software 4 

Human Systems Dynamic 76 

Huntington Computing 94 

Intec Peripherals Corp 25 

Interesting Software 9 

John Bell Engineering 21 

L Com 55 

Leading Edge BC 

Logical Devices 20 

Lyco Computing 52 

Nibble 107 

Manx Software 76 

MlCRObits (Classifieds) 88,93 

Microcomputing 32 

MICRO INK 15. 45 



Micro Motion 

Micro Signal 

Micro-Ware Distributing, Inc.. 

Modular Mining Systems 

Modular Systems 

Performance Micro Products. 

Perry Peripherals 

Privac 

RC Electronics 

RH Electronics 

Scientific Software 

SGC 



...59 

. 93 
. . 68 

. .87 
...25 

. 69 
. . 60 

. 42 
. . 35 
.6,80 
. .88 

..46 



SJB Distributors 30 

Skyles Electric Works 8 

Smartware .97 

Softronics -2 

Softside Publications 108 

Sorrento Valley Assoc 36 

Talbot Microsystems 59 

Unique Data 100 

Versa Computing 10 

Vista Computing IBC 

XPS, Inc 99 

Zytrex 50 



MICRO INK is not responsible for claims made by its adver- 
tisers. Any complaint should be submitted directly to the 
advertiser. Please also send written notification to MICRO. 



No. 57 - February 1983 



MICRO 



111 



Next Month in MICRO 



New Section for the Serious Novice! 

Developing Computer Literacy — Appearing 
monthly in MICRO; basics for honne and for school, 
in easy-to-understand ternns. Learn how to develop 
connputer literacy using the VIC-20, Connnnodore 64, 
Atari 400, TRS-80 CC, TI-99, Sinclair Tinnex, as well 
as the Apple, PET, or Atari 800. Look for 

MICROCalc for VIC and all Connnnodore connputers, 
Apple, and CC — a worksheet progrann to define 
and perfornn calculations. 



DIGI-DRAFT — An Atari graphics progrann for 
drawing images on the screen to save on tape or 
disk for retrieval later. 

BANNER: A Display Program for the CC — The 
scrolling screen displays any message of your 
choice. 

The Computer Revolution — A look at the public's 
response to computers. 



March: Printer Feature 

MULTIC — Multic Column Print for the AIM 

A Full Byte for Your Apple Printer 

PRINT- USING on the Apple 

Plotting with the VIC 

Disk ID for OSI Printed Directories 



Plus: 

A Versatile Hi-Res Graphics Routine for the Apple 
Animated Graphics on the 6809 
Single Floppy Disk Interface for 6502 



20% OFF 

Your mortey goes farther when you sub- 
scribe. During the course of a year, when you 
subscribe, you save 20% (in the U.S.). 

Pay only $24.00 ($2.00 a copy) for 12 monthly 
issues of MICRO sent directly to your home or 
office in the U.S. 



More MICRO for Less Money 
When You Subscribe 

But on the newsstand — if you can locate the 
issue you want — you pay $30.00 a year ($2.50 
a copy). 

Special Offer — Subscribe for 2 years ($42.00) 
and get 30% off the single issue price. 

Subscribe to MICRO today. 



MICRO 

34 Chelmsford Street 
P.O. Box 6502 
Chelmsford, MA 01824 

Please send me MICRO for 1 year 2 years 

NOTE: Airmail subscriptions accepted for 1 year only. 



Subscription Rates Effective January 1, 1982 
Country Rate 



Check enclosed $_ 
Charge my 

No 



. VISA account 

. Mastercard account 



United States 

Foreign surface mail 

Europe (air) 

Mexico, Central America, Mid East, 

N. &C. Africa 
South Am., S. Afr., Far East, 

Australasia, New Zealand 



$24.00 1 yr. 
42.00 2 yr. 
27.00 
42.00 

48.00 

72.00 



Expiration date . 
Name 



* Airmail subscriptions accepted for only 1 year. 
For U.S. and Canadian 2-year rates, multiply by 2. 



Address 



City/State . 



Job Title: 



-Zip 



Type of Business/Industry: 



112 



MICRO 



No. 57 ■ February 1983 



GREAT INNOVATORS* 




15th century renaissance man, Leonardo Da Vinci, con- 
tributed an inexhaustible collection of inventions and ideas 
to solve the world's problems. These ideas were centuries 
ahead of their time. The studies on this page deal with ex- 
periments in manned flight. 

Like Leonardo, Vista Computer is answering many of 
today's complex computer storage problems. The Vista 
V1200 is a great solution to Apple II™ storage. Mass storage 
for your Apple IF" Computer has always been a problem. On 
one hand, there were the exotic, expensive hard disks with 
no cost efficient means of backup. On the other hand, the 
Apple floppy drive lacked the speied and storage demanded 
by today's professionals. 

Vista's V1200 offers both at an incredibly attractive price. 
The removable VistaPak cartridges offer 6 Megebytes of 
removable storage each and can be backed up like a floppy. 

now hard disk storage and speed can be yours with the added 
capability of interchangeable media. The V 1200 eliminates 



^\ 




the worries of head crashes, drive alignments, lost data, or 
backup with a, new application of field-proven floppy 
technology. 

The VistaPak cartridges hold 6MB of formattedfdata each. 
The removable cartridge allows you to keep duplicates of 
your valuable data as well as to keep separate paks i$3X your, 
accounting, word processinO/ spread sheet and other aoplh' 
cations, rio other storage device oftcrb nioiu in flexibility 
and capability. . - ] 

• Micropiocoisur cuiilrolled diivc • DMA Controller * 
Removable Data Cartridges • CPT^eil. DOS Ar Piibcal compati- 
ble •' Qukkchargc^^, DOSeiihancemcTitinLluded • iiuJudcii 
. 1 VistaPiak cartridge • Vista I ,i{» Day Wairanty *,"?*' 

' ' ' **. 



. Contact Your Local Vfsta Dealer or Call our VIsta/lotlines. 

■^' , COMfiiTER """ • i?\ 
jWBE'COM'P/SNYiNcfej /■ 

1^17 East Edin^r ^$^nLft AriA CA 9276a-->'«*)- - > <., 
47 141 953-0523 '/ C8Qpf|S^-8()r7 . .,. f-;'?^' ■" 







'Z *PP'^ " is a registered trademark of Apple Computer Co. 

7% 



- DISTRIBUTORS"/ 

Wrsh-iii Cir iiip3*hnlt«lr ,'* '• *- 
1.IM9JTB4* i1(N)t73^ 
- Stiiith lintiil 1 K SyiiPitiT 






l»» ^• 



._ , . — . r sA-KtlJlplllBjh.... ,. 

I307 . ■**:_ji5*' , f •■■eJls"47hJ*<i\ 9iAs,l^r ' 
. ■■ ***^ " ■ - •I-*-* i' '-n •• aSEnSe, ■"• 



i.- 









", -.-s-jp,: ■ 



^•.^^^''^-•^'■'^^mH. 




THE PROWRITER GOMEIH 




(And It Cometh On Like CangbustersJ 

Evolution. 

It's inevitable. An eternal 
verity. 

Just when you think you've 
got it knocked, and you're 
resting on your laurels, some- 
body comes along and makes 
a dinosaur out of you. 

Witness what happened to 
the Centronics printer when 
the Epson MX-80 came along 
in 1981. 

And now, witness what's 
happening to the MX-80 as 
the ProWriter cometh to be 
the foremost printer of the 
decade. 
SPEED 

MX-80: 80 cps, for 46 full lines 
per minute throughput. 
PROWRITER: 120 cps, for 
63 full lines per minute 
throughput. 
GRAPHICS 

MX-80: Block graphics standard, 
fine for things like bar graphs. 
PROWRITER: High-resolu- 
tion graphics features, fine 
for bar graphs, smooth curves, 
thin lines, intricate details, etc. 
PRINTING 

MX-80: Dot matrix business 
quality. 

PROWRITER: Dot matrix 
correspondence quality, with 
incremental printing capability 
standard. 
FEED 

MX-80: Tractor feed standard; 
optional friction-feed kit for 
about $75 extra. 
PROWRITER: Both tractor 
and friction feed standard. 
INTERFACE 
MX-80: Parallel interface 
standard; optional serial 
interface for about $75 extra. 
PROWRITER; Available stan- 
dard-either parallel interface 
or parallel/serial interface. 
WARRANTY 

MX-80: 90 days, from Epson. 
PROWRITER: One full year, 
from Leading Edge. 
PRICE 
Heh, heh. 

Marketed Exclusively by Leading 
Edge Products. Inc.. 225 Turnpike 
Street, Canton. Massachusetts 
02021. Call: toll-free 1-800-343-6833; 
or in Massachusetts call collect 
1617)828-8150 Telex 951-624. 



LEAMHG 
EDGr 

For a free poster of "Ace " 
IProwriter's pilot I doing his thing, 
please write us.